hi,
In my web applcation i’ ve integrated the okta widget.
Login works correctly and in the dashboard I can see my user authenticated, but the redirect page doesn’t work .
I receive this message:
400 bad request
Provider di identità: Unknown
Codice errore: invalid_request
Descrizione: The ‘redirect_uri’ parameter must be an absolute URI that is whitelisted in the client app settings.
I assume that you have created a “Web Application” in Okta developer console.
While creating the app, you need to provide “Login redirect URIs” which should be the same as the redirect page.
You can update your existing app in okta, to use your redirect URI.
Once you do that, you should be able to redirect back to the page after authentication.
first of all thanks for your help.
Your assume is correct I have created a Web application, I also set up the redirect URI (you can check that the page works)
Looking at your error, I’m pretty sure, the redirect URL is not added in the Trusted Origins section in your okta org configuration. This is an application specific configuration which you should be able to access from the okta dashboard.
only a clarification the first login page works, it authenticate me! Only the redirect doesn’t work, as I wrote before the dashboard trace the succefull login
No, that’s not the access token.
In your code you’re getting the access token inside oktaSignIn.token.parseTokensFromUrl block, specifically the line var accessToken = res[0]
It is not the authorization code either.
These cookies are OIDC specific values that are used to mitigate Cross-Site Request Forgery (CSRF, XSRF) & replay attacks. You need not worry about them, as they’re verified by the widget.
If you’re interested, read this - http://openid.net/specs/openid-connect-core-1_0.html#IDToken
Coming back to your other question.
You don’t need to exchange authorization code for token(s) because you have specified responseType as token, id_token, which means you directly get back the tokens in the redirect URL. This is the implicit flow.
The one where you would exchange code for token is the authorization code flow.
Looking at your earlier code you posted, you are using the implicit flow, which doesn’t need any token exchange.
So now i am now able to retrieve id token and get information about user ? Could you give me an url with the code that describe how to retrieve user information? Thanks a lot for your help
The information about the user is embedded within the id_token.
To request more information about the user, you use pass the following scope values in your params - authParams: { scopes: ['openid', 'email', 'profile', 'address', 'phone'] }
And once you get back your id_token, you can access the user information using the claims in the token.
E.g idToken.claims.email, idToken.claims.name