[GH-ISSUE #2203] [bug]: How to specify the token for self-hosted proxyscotch? #751

Closed
opened 2026-03-16 17:01:06 +03:00 by kerem · 3 comments
Owner

Originally created by @zhzy0077 on GitHub (Mar 25, 2022).
Original GitHub issue: https://github.com/hoppscotch/hoppscotch/issues/2203

Is there an existing issue for this?

  • I have searched the existing issues

Current behavior

There's no way to specify a token for proxyscotch.
So I get response:

(Proxy Error) Unauthorized request; you may need to set your access token in Settings.

Steps to reproduce

  1. Setup a proxyscotch instance by proxyscotch-server-* --host 0.0.0.0:9159 --token 123456
  2. Connect hoppscotch to the instance by specifying the PROXY URL as 'http://localhost:9159'
  3. Call any API from hoppscotch.

Environment

Production

Version

Self-hosted

Originally created by @zhzy0077 on GitHub (Mar 25, 2022). Original GitHub issue: https://github.com/hoppscotch/hoppscotch/issues/2203 ### Is there an existing issue for this? - [X] I have searched the existing issues ### Current behavior There's no way to specify a token for proxyscotch. So I get response: ``` (Proxy Error) Unauthorized request; you may need to set your access token in Settings. ``` ### Steps to reproduce 1. Setup a proxyscotch instance by `proxyscotch-server-* --host 0.0.0.0:9159 --token 123456` 2. Connect hoppscotch to the instance by specifying the PROXY URL as 'http://localhost:9159' 3. Call any API from hoppscotch. ### Environment Production ### Version Self-hosted
kerem 2026-03-16 17:01:06 +03:00
Author
Owner

@dislazy commented on GitHub (Apr 11, 2022):

all in https://firebase.google.cn/ ,include storage auth and more,set it packages/hoppscotch-app/.env

<!-- gh-comment-id:1095015100 --> @dislazy commented on GitHub (Apr 11, 2022): all in https://firebase.google.cn/ ,include storage auth and more,set it packages/hoppscotch-app/.env
Author
Owner

@liucent commented on GitHub (Aug 12, 2022):

all in https://firebase.google.cn/ ,include storage auth and more,set it packages/hoppscotch-app/.env

Hi all, I checked proxyscotch code and I think it may be 'AccessToken' parameter in source code(proxyscotch/libproxy/proxy.go).
But there is no token or accesstoken parameter in .env. So is there any way to specify proxyscotch token on hoppscotch side, in settings page or other config file? Wish hoppscotch readme documents can add 'how to set proxyscotch token part'.

<!-- gh-comment-id:1212734524 --> @liucent commented on GitHub (Aug 12, 2022): > all in https://firebase.google.cn/ ,include storage auth and more,set it packages/hoppscotch-app/.env Hi all, I checked proxyscotch code and I think it may be 'AccessToken' parameter in source code(proxyscotch/libproxy/proxy.go). But there is no token or accesstoken parameter in .env. So is there any way to specify proxyscotch token on hoppscotch side, in settings page or other config file? Wish hoppscotch readme documents can add 'how to set proxyscotch token part'.
Author
Owner

@biondizzle commented on GitHub (Oct 16, 2022):

@zhzy0077 @liucent
If you're selfhosting, the easiest way I found was to add
accessToken the payload object in packages/hoppscotch-app/src/helpers/strategies/AxiosStrategy.ts here:

github.com/hoppscotch/hoppscotch@6e7d28db7b/packages/hoppscotch-app/src/helpers/strategies/AxiosStrategy.ts (L31)

so it will look like this:

let payload: ProxyPayloadType = {
    ...req,
    wantsBinary: true,
    accessToken: "MyVerySecureToken",
  }

And that will fill in the token to this struct:
github.com/hoppscotch/proxyscotch@2e94def1c2/libproxy/proxy.go (L30)

Which will get set when the request body is decoded here:
github.com/hoppscotch/proxyscotch@2e94def1c2/libproxy/proxy.go (L206)

I'm sure there's some way to add it into here: github.com/hoppscotch/hoppscotch@6e7d28db7b/packages/hoppscotch-app/src/helpers/strategies/AxiosStrategy.ts (L16)

If I could figure that out I would've submitted a PR so it gets set from an environment variable, but I don't know typescript and wasn't about to go down that rabbit hole.

Hope this helps.

<!-- gh-comment-id:1279866590 --> @biondizzle commented on GitHub (Oct 16, 2022): @zhzy0077 @liucent If you're selfhosting, the easiest way I found was to add `accessToken` the payload object in `packages/hoppscotch-app/src/helpers/strategies/AxiosStrategy.ts` here: https://github.com/hoppscotch/hoppscotch/blob/6e7d28db7b8f9ce3fe5735bcb59e2c32195111c0/packages/hoppscotch-app/src/helpers/strategies/AxiosStrategy.ts#L31 so it will look like this: ``` let payload: ProxyPayloadType = { ...req, wantsBinary: true, accessToken: "MyVerySecureToken", } ``` And that will fill in the token to this struct: https://github.com/hoppscotch/proxyscotch/blob/2e94def1c28106f556718feb33232a8d1a8471b5/libproxy/proxy.go#L30 Which will get set when the request body is decoded here: https://github.com/hoppscotch/proxyscotch/blob/2e94def1c28106f556718feb33232a8d1a8471b5/libproxy/proxy.go#L206 I'm sure there's some way to add it into here: https://github.com/hoppscotch/hoppscotch/blob/6e7d28db7b8f9ce3fe5735bcb59e2c32195111c0/packages/hoppscotch-app/src/helpers/strategies/AxiosStrategy.ts#L16 If I could figure that out I would've submitted a PR so it gets set from an environment variable, but I don't know typescript and wasn't about to go down that rabbit hole. Hope this helps.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/hoppscotch#751
No description provided.