-
-
Notifications
You must be signed in to change notification settings - Fork 3.6k
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
Allow customizing state #5727
Comments
The use case seems to be the same as #5375 but sounds a bit more versatile and could potentially be used for other purposes as well, so I think we are open to a change like this. 👍 The only change that this might need is to honor a user value here:
I think passing through
What do you think? |
Are you open to making state become base64 JSON with a "secret" field. Then users can add whatever additional fields they want. Alternatively, or in addition, a way to create the state on a per-request basis would be useful too, by e.g., passing a function that receives the request. |
Changes suggested by @balazsorban44 seem sufficient to support checking of user-supplied @jasonkuhrt users can somewhat do request-based state creation and read, but I suppose it comes at a performance cost.
One additional change I was thinking of is making the Full patch:
|
…e provider and signIn callback (nextauthjs#5727)
This seems to be possible using My use case is similar albeit a bit different. We want to redirect a user back to the page where specific page where they entered the website instead of back to the landing page. Our users for example can register devices by scanning QR codes which lead to our website with some payload set. When they have no session they are then redirected to our SSO but after the login they are at our landing page and all the custom payload (path, query params) are lost and the user has to scan the QR code again. |
It's the end of 2024 already. Any update? |
Bump on this one. It would be useful to allow my application to use the returned oauth account details differently depending on the context the signin was made from. I can't do it with the redirect url because the account details are not forwarded. You maybe just check for the users most recently authenticated oauth account but that seems a little hacky. Also, say i wanted to make my signin callback behave different based on the context of the signin, I can't, so it would be nice to have to state available in the callbacks. |
This issue is killing me slowly |
Description 📓
Allow customizing the
state
query string parameter of authorization URL sent by OAuth providers like GitHub.E.g.:
Motivation:
The reason we control it is that GH App only allows specifying ONE callback URL.
This is a big problem for dynamic preview deployments, like per PR ones.
The solution we managed and have been using for 1.5 years now is to, in preview, have the gh app redirect to PDP CP router microservice which will in turn look at the state (base 64 encoded json data) and if it finds a redirect url, honour it.
This solves the problem because each pdp cp preview deployment controls the state it creates when trying to login via github.
We do not apply this pattern in production.
How to reproduce ☕️
N/A
Contributing 🙌🏽
Yes, I am willing to help implement this feature in a PR
The text was updated successfully, but these errors were encountered: