<iframe src="https://www.googletagmanager.com/ns.html?id=GTM-M74D8PB" height="0" width="0" style="display:none;visibility:hidden">
Loading
Skip to NavigationSkip to Main Content
0D54z00007avHl6CAEOkta Classic EngineSingle Sign-OnAnswered2024-03-25T06:01:21.000Z2022-04-22T15:38:30.000Z2022-04-25T13:40:09.000Z

tidy9 (tidy9) asked a question.

Incorrect error callback URL in OIDC workflow

Hi everyone!

I'm looking into implementing Open ID Connect authentication in a Web app and I was working on a test app using an Okta developer account when I encoutered a weird behavior with error handling.

 

Let's say my test app uses an Authorization code flow and has implicit mode disabled. If I redirect the user to the /authorize endpoint with the redirect_type set to 'token' it is supposed to return an error which is what happen.

However, the HTTP 302 response I get from Okta redirects the browser to a location that looks like :

 

http://localhost:3000/authorization-code/callback#state=bb8cef44-c459-4a2d-9405-355f5f4fa6cf&error=invalid_request&error_description=.........

 

Notice the hash ('#') character before the query parameters. Isn't it supposed to be a question mark? Note that when authentication is successful the redirect location is correctly formatted with a ?. I have not tested with a real Okta identity provider so I don't know if that problem would happen in a production environment. However that makes it quite difficult to intercept authentication errors while working on a test project with an Okta developers identity provider.


  • andrea.skouras (Okta, Inc.)

    Hi Nathan,

     

    As you are specifying token as your response_type, `query` is not supported as the response_mode. When you are using implicit flow and you do not supply a response_mode, Okta defaults to returning the response via a hash fragment, as you are seeing. This behavior is covered in our OIDC reference over here.

     

    If you remove your response_type OR change your response_type to `code` and otherwise generate a request that will fail (such as for a non existent scope or a user not assigned to the app), you should see the error instead returned as a `query` parameter.

    Expand Post
    Selected as Best
  • andrea.skouras (Okta, Inc.)

    Hi Nathan,

     

    As you are specifying token as your response_type, `query` is not supported as the response_mode. When you are using implicit flow and you do not supply a response_mode, Okta defaults to returning the response via a hash fragment, as you are seeing. This behavior is covered in our OIDC reference over here.

     

    If you remove your response_type OR change your response_type to `code` and otherwise generate a request that will fail (such as for a non existent scope or a user not assigned to the app), you should see the error instead returned as a `query` parameter.

    Expand Post
    Selected as Best
  • tidy9 (tidy9)

    Thank you, I haven't paid attention to this parameter since I did not have to use it in any of the examples I looked into. Another thing I realized is that since the implicit flow is designed for use in single-page applications where the client handles the auhtentication, this behavior is not that big of an inconvenient because the fragment part of the callback URL is visible on the client's side.

This question is closed.
Loading
Incorrect error callback URL in OIDC workflow