-
Notifications
You must be signed in to change notification settings - Fork 17
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
Using Auth0 as IDP and manage on Client the redirection. #23
Comments
There's a yew-oauth2/src/components/context/mod.rs Line 43 in c60380d
It defaults to the current URL. I am not sure this is exposed at the moment. But I think this should be the right feature to leverage. |
Ah, double checking … it's exposed as part of the |
Ah … and triple checking (should have done that first) … that was you already use. Hm … |
Ok, checking the Auth0 docs, that looks like an interesting limitation. IIRC Keycloak does allow a prefix, and even allow for certain wildards. So I guess you need to follow the idea of Auth0, and encode this somewhere in a cookie, session, or state variable. |
Hi @ctron, Yes indeed. Unless I'm mistaken but I have set My second problem is to be able to capture the url of the ressource that I'm trying to access in order to be able to pass it in a state or a cookie to the authorization endpoint. Is this supported? An idea on how to do this? |
Taking a closer look at the code, I think everything should already be there: Lines 441 to 450 in 62187a9
I am not sure why it doesn't work … I guess you will need to debug this. |
Hi @ctron. I'm trying to find out what is going on. I have forked the solution and set couple of log points: There is something clearly happening somewhere that cleans the LoginOptions because the audience and the scopes are conserved which are set at the same place are conserved:
|
Weird indeed. But I have no idea what's going on. And you seem to have a reproducer at hand :) |
I've found this article that describe the need for anyone else reading the issue https://community.auth0.com/t/how-do-i-set-up-a-dynamic-allowed-callback-url/60268 @ctron I'm going to investigate a little further but I'm not even sure I will be able to capture and store the protected ressource url with the yew-oauth2 API before starting the login process. I'm wondering if I would not be better building my own custom oauth agent for auth0. I need to have it working now. :( thanks for the help you provided. |
@ctron Do you know why is LoginOption passed as parameters on the
Cause LoginOptions is an attribute of the config and is set there. I mean InnerConfig has an attributes option which contains the proper LoginOption value.... |
IIRC the original ideas was to allow one to manually start a login process (e.g. from your own component) with some additional options. |
In the code I linked earlier, you will find 3 variables which are stored in the session store. I would suggest to add that information there. Then check the corresponding section where those variables are read again, and I you find our value stored, apply it.
I you believe that to the faster, that might be your better approach then. But from what I see, it should just be a few changes. But I also can't do that for you, as I don't have your environment set up, and also don't have the time to invest into that issue right now. |
That is an excellent idea! I could leverage this. Then I guess this is where it happens. It never takes the one coming from the inner config and takes the one from the "manual" start and this override the one set on the OAuth2 component. I will look into this. |
Thanks for dealing with this :) I'm facing the same issue with app using Microsoft Entra as IDP. If you need any testing or help, please let me know |
Ok, I dug a bit into this, the reason for this is that the Good news, this should be an easy fix. |
@kate-shine @AlexandreRoba there's a PR for this now: #24 … it would be great if you could give it a try. You should be able to do this using: [patch.crates-io]
yew-oauth2 = { git = "https://github.com/ctron/yew-oauth2", rev = "4342e94907799da7d305492e0b7df3a8326373b4" } |
@ctron thanks a lot for this. I was dragged into other issues. i will give it a try this we. |
Hi @ctron , Thanks for replying to me.
Here is the issue I'm facing. I'm trying to use Auth0 as IDP and I need to configure on Auth0 the authorized returnUrls.
Auth0 does not allow to have "Generic" returnURLs. So we need to have a fixed set of defined returned Url.
But when using Yew-Oauth (Which is a great Thanks for that :p) the token lives in the app context.So on any refresh or reload of the page we loose this token and we are redirected to auth0 to get a new token. Which makes full sens. But we can be redirected from any page on the app which requires authentication such as for example https://localhost:3000/orders/xxxx/items/details...... xxx could be infinite... So no way to configure this on Auth0.
One way to tackle this could be to use on our app a defined url such as /callback?appReturnUrl=<<https://localhost:3000/orders/xxxx/items/details must be url encoded of course :p>> or a state parameter which will contains the url of the protected ressource and redirect the user to this value when /callback is called.
In order to do so we need to be able to "Inject" the returnUrl when redirecting to the authorization endpoint when accessing a protected ressource taking the current page url and add it as the appREturnURl or state.
My understanding is that we should use for this the LoginOptions parameters, so as a first step I used this code:
My understanding is that it is supposed to override the default returnUrl with what it is specified on the
with_redirect_url
. But it does not. When the user tries to access a protected ressources he still get as returnUrl the url of the protected ressource:Once I have this working I will need a way on this configuration to inject the url of the protected ressource as the appReturnURL...
I do not see how to do this differently in order to implement the silent login on an unlimited custom list of return urls with auth0 as they do not support wildcard parameters on the return url :(
This is also what is explain here https://auth0.com/docs/authenticate/login/redirect-users-after-login.
The text was updated successfully, but these errors were encountered: