-
Notifications
You must be signed in to change notification settings - Fork 287
feat(lazer/js/sdk): QSP auth for browser support #3014
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
base: main
Are you sure you want to change the base?
Conversation
The latest updates on your projects. Learn more about Vercel for GitHub.
5 Skipped Deployments
|
if (isBrowser()) { | ||
// Browser: Add token as query parameter | ||
const urlObj = new URL(url); | ||
urlObj.searchParams.set("ACCESS_TOKEN", token); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If this is available as a query param, why use bearer auth at all? Seems like if you have to support query param auth it's simpler to just always use the query param and never set the header...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeahh, considered that, but we prefer people use the header whenever possible to avoid leaking the token in logs/some nginx somewhere/etc.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ah yeah that's fair
function addAuthentication( | ||
url: string, | ||
token: string, | ||
wsOptions: any = {} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In general you shouldn't ever use any
; here you should type this correctly to match the types that are valid as options here. If you must, you can use unknown
, but I don't think that makes sense in this case.
Summary
Rationale
How has this been tested?