Guide
Protect a tunnel with an access token
Protect a tunnel with a secret token that scripts, AI clients and webhook providers can send in a header.
- Applies to
- Starter and higher; durable tunnels
- Time
- About 5 minutes
- What it changes
- Every request to the tunnel needs the token. Your app never sees the token.
- Last reviewed
- , by Product documentation
Before you begin
What to know before you start
- The token is shown once. Copy it before you close the dialog; if you lose it, create a new one.
- Creating or replacing a token ends the tunnel's live connection. Your connector reconnects on its own.
Steps
Step 1. Open the tunnel in the dashboard and choose Access token, then Create token.
You should see: A dialog shows your access token once.
Step 2. Copy the token and keep it somewhere private.
You should see: You have the token in your password manager or your secret store.
Step 3. Send the token with each request.
Send it in the X-InstaWormhole-Token header, or as a bearer token in the Authorization header.
Terminal curl -H "X-InstaWormhole-Token: <token>" https://example.instawormhole.site/Terminal curl -H "Authorization: Bearer <token>" https://example.instawormhole.site/Replace <token> with your token and example with your tunnel's name. The tunnel checks the token and does not pass it to your app, so your app can keep its own authentication.
You should see: The request reaches your app and returns its answer.
To check: Send the same request without the header. The tunnel answers 401.
You are done when
- A request without the token is refused.
- A request with the token reaches your app.
What to do next
If something goes wrong
- You lost the token.
- Create a new token with Replace access token. The old token stops working. The token cannot be read back.
- Requests with the token are still refused.
- Check that the header name is spelled exactly X-InstaWormhole-Token, or that the Authorization header starts with Bearer and a space.
Undo or clean up
- To remove token protection, choose Remove access token on the tunnel.
Related
This page is part of Share and protect. Still stuck? Contact support.