-
Notifications
You must be signed in to change notification settings - Fork 838
Docs: show state param #301
Comments
@brockallen can you provide description for this, I would like to contribute to this. Thanks :) |
I wanted to document how to send state on the request and then how to access it on the callback. You could put some text into this issue and I can copy it over into the wiki. |
@brockallen Ok sounds good. I am also facing this one issue where the |
@brockallen any updates on this? Can I find somewhere documentation explaining how to pass state on the request and get back whenever using |
I believe that currently it's not possible to change the state ID without some crazy hacks. If that's the case, then setting up a single redirect_uri for multiple domains using the same OAuth client (useful if you have many dynamic subdomains using the same OAuth client) is virtually impossible, as you cannot access the state Please correct me if i'm wrong, I've had a good look but it seems that this is currently the case. Found this issue asking for support for a similar idea, the only difference being in my case, I cannot whitelist domains as they're dynamically generated (i.e. Review Apps via GitLab) #432 |
The short answer is that when you call
|
Right, but is that outside the context of the popup (for example)? I was under the impression that that callback will be fired by the |
@dejan9393 I don't know what your popup issue is. The state should work for popups as well. @arwalokhandwala The state values you pass at signin time are only available during the callback when completing the protocol response. In short, they're meant to help your callback function restore the state of your app once the user returns from logging in. It's not meant to last longer than that. |
@brockallen I'm saying that the |
Correct, because in the protocol the
I'm not following this and i just tested the sample using the popup flow and it's working AFAICT. You can even see in the logs that the state is returned: The |
Thanks for the detailed response. I think the fundamental difference between your test and my use-case is that I have a multi-tenant application, of which some of the URLs are dynamically generated. For this reason, I cannot add a redirect URL for all instances of the application, so my solution was to route them all through a single constant redirect URL, which then redirects back to the original application (from inside the popup), before then posting back to the opener window. Example
We have 3 domains:
Have I got the right idea, or is there a better solution to this problem? Also would like to genuinely thank you for this amazing library that's saved me probably hundreds of hours, and for your time on these tickets - I know you're very busy with other OS projects, too. |
Did you solve your problem? I have exactly the same issue and am trying to figure out how to solve it. |
@vaalkor I went with the solution I proposed in the comment you're replying to, didn't end up finding a conclusive answer and it seemed reasonable enough to me. Basically you have 1 main redirect URL that all of your apps go through:
Save the actual redirect URL of the app you're currently in to the
Set up your oidc-client with that redirectURI and state parameter and trigger the popup/iframe flow:
In the popup/iframe handler code (
I pulled out bits and pieces of my code so the above is not exactly complete, but hopefully it gives you a general outline of the process. Hope that helps! |
No description provided.
The text was updated successfully, but these errors were encountered: