Error 400 bad request

If you’re using java, you should be using the authorization code flow.
We have sample code in java spring that demonstrates this flow here - https://github.com/okta/samples-java-spring-mvc

If you’re using spring-boot in your back-end, you can use this client library as well - https://github.com/okta/okta-spring-boot

I am having the same error and still not figuring out why even with your advice. I’ve followed this guide but still error 404 “The ‘redirect_uri’ parameter must be an absolute URI that is white-listed in the client app settings”. I’ve correctly routed the login callback url to “http://localhost:4200/implicit/callback” (indeed when i manually connect to it it says “AuthSdkError: Unable to parse a token from the url”), added the url on the login application and white-listed “http:\localhost:4200” inside “Trusted Origins” menu. Any idea?

hi,
tomorrow I Will send my code and configuration

@Lamba92 can you confirm you pasted http://localhost:4200 and not http:\localhost:4200

It might also be worth checking for any extra spaces that you might have added.

It is correct in the dev panel, it was a typo in the post but i couldn’t fix it because i can only add 2 links in a single post and there were already 2.

thanks you :slight_smile:

EDIT: solved! there was a typo deep down in my code :sweat_smile:

Hi Tom,
I am also facing same issue on my Asp.Net application with VS2015.
I am not using any such script like above mentioned,but following the below URL for creation of project:
https://developer.okta.com/blog/2018/08/29/secure-webforms-with-openidconnect-okta
Please let me know if any suggestion do you have.

Regards
Ranjan Singh

Hi @RanjanSingh

Please follow the article available here to resolve the error The ‘redirect_uri’ parameter must be an absolute URI.

Hi @dragos ,
Thanks for your reply,I already have follow the given article in early days,it was not working.I tried today also,Thr redirected URL is:

https://dev-665751.oktapreview.com/oauth2/v1/authorize?client_id=0oajda0nj0aOpcYz00h7&redirect_uri=https%3A%2F%2Fhttp%3A%2F%2Flocalhost%3A55735%2Fcallback%2F&response_mode=form_post&response_type=code%20id_token&scope=openid%20profile&state=OpenIdConnect.AuthenticationProperties%3D4lAUPSpFXXpCPPpzUrz3-JLMCdjDUiwU4YMcKi9ao7HtGhTd9AziiBM2wbDeLSnkmEEupc4NMBrLfM36wP9mXtbNg5aYB0tepUqaSNN2o5Y-ARDAR0Fdp0zHimSYSNdFyhU0Q4nhUEbTyXtiSy0gVh3pESWSFDQpAnex_NQpNSJt-mfGMPr1bb0yLd2l1yUs&nonce=636862536548365527.MmQ2NzZhZjktYzRiMC00NWVjLWI2YTEtMTA1ZmZmMDFiYjA2YTliNDA0ODItYTE2My00YWMyLTg2OTUtYjFlNWQyMzMxMzQ0&x-client-SKU=ID_NET451&x-client-ver=5.2.1.0

Please let me know if any other steps need to perform.
PFB attached screenshots for General setting of OKTA for reference.

Hi @RanjanSingh

In the GET parameters, the redirect_uri is incorrect “https://http://localhost:55735/callback/”. Also, the URL must match the one that you have under General tab >> Login Redirect URIs, which, in the screenshot provided, is “http://localhost:55735/my-app/signin.html/

Another issue that I see is that you are requesting both id token and authorization code. When passing the authorization code to /token endpoint, you will receive both id token and access token from Okta.

After doing the modifications, the URL should look like the following

https://dev-665751.oktapreview.com/oauth2/v1/authorize?client_id=0oajda0nj0aOpcYz00h7&redirect_uri=http://localhost:55735/my-app/signin.html/&response_mode=form_post&response_type=code&scope=openid profile&state=OpenIdConnect.AuthenticationProperties=4lAUPSpFXXpCPPpzUrz3-JLMCdjDUiwU4YMcKi9ao7HtGhTd9AziiBM2wbDeLSnkmEEupc4NMBrLfM36wP9mXtbNg5aYB0tepUqaSNN2o5Y-ARDAR0Fdp0zHimSYSNdFyhU0Q4nhUEbTyXtiSy0gVh3pESWSFDQpAnex_NQpNSJt-mfGMPr1bb0yLd2l1yUs&nonce=636862536548365527.MmQ2NzZhZjktYzRiMC00NWVjLWI2YTEtMTA1ZmZmMDFiYjA2YTliNDA0ODItYTE2My00YWMyLTg2OTUtYjFlNWQyMzMxMzQ0&x-client-SKU=ID_NET451&x-client-ver=5.2.1.0

If we access it, it will still give an error. Please check to see if the client_id that is present in the URL matches the one that you have for the application presented in the screenshot.