Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Impossible to use App Secret in a browser #516

Closed
amakhrov opened this issue Aug 1, 2022 · 5 comments · Fixed by #517
Closed

Impossible to use App Secret in a browser #516

amakhrov opened this issue Aug 1, 2022 · 5 comments · Fixed by #517

Comments

@amakhrov
Copy link

amakhrov commented Aug 1, 2022

When I try to use api secret in my local environment, it throws You are publicly sharing your App Secret. Do not expose the App Secret in browsers.

The README has the following note on the subject:

If you are running backend code in Google Cloud or you know what you're doing, you can specify browser: false in options to skip this check.

Well, I know what I'm doing (it's going to be a developer tool only available locally, with api secret read from environment).
Yet, the suggestion specify browser: false doesn't work. It doesn't just suppress the error. It also tells the stream-js client to use Node packages (http.Agent) - resulting in a run-time error in a browser. https://github.com/GetStream/stream-js/blob/main/src/client.ts#L257 .

As such, the note in README is misleading. It feels like a mistake in the code rather then the docs though.

Thanks

@ferhatelmas
Copy link
Contributor

This repo is about feeds. You are referring another repo: https://github.com/getstream/stream-chat-js which is chat client.
Relevant line is here: https://github.com/GetStream/stream-chat-js/blob/01bf0acd0ac7b13ca9b0e3e61a3f45820fadb1a2/src/client.ts#L164

@amakhrov
Copy link
Author

amakhrov commented Aug 1, 2022

Nope, it's about feeds, specifically in relation with token generation:
https://github.com/GetStream/stream-js#api-client-setup-node--browser

@ferhatelmas
Copy link
Contributor

I see your point now, will make a patch.

@ferhatelmas
Copy link
Contributor

8.0.2 should fix your use-case, let me know how it goes.

@amakhrov
Copy link
Author

amakhrov commented Aug 1, 2022

Thanks, looks good!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants