FusionAuth
    • Home
    • Categories
    • Recent
    • Popular
    • Pricing
    • Contact us
    • Docs
    • Login

    PKCE Verification Fails

    Scheduled Pinned Locked Moved General Discussion
    4 Posts 3 Posters 2.2k Views
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • R
      rmachorro
      last edited by

      I have a pre-existing FusionAuth integrated application that uses Authorization Code successfully. For safety reasons I'm adding support for PKCE.

      I've added code_challenge and code_challenge_method to the authorize url, so it looks like this:

      https://.../oauth2/authorize?client_id=...&tenantId=...&redirect_uri=.../authcallback&response_type=code&scope=openid&state=...&code_challenge=...&code_challenge_method=S256
      

      Upon response to callback, the code is then sent back to FusionAuth in the Token request, adding the code_verifier:

      POST /oauth2/token HTTP/1.1
      Content-Type: application/x-www-form-urlencoded
      Host: ...
      Connection: close
      Content-Length: 241
      
      client_id=...&redirect_uri=...%3A3000%2Fauthcallback&code=...&code_verifier=...&grant_type=authorization_code
      

      The response is a 400 Bad Request with the following body:

      {"error":"invalid_request","error_description":"Invalid Authorization Code","error_reason":"auth_code_not_found"}
      
      danD 1 Reply Last reply
      Reply Quote 0
      • danD
        dan @rmachorro
        last edited by

        @rmachorro What version of FusionAuth are you using? At first glance that appears to be the right way to do it.

        --
        FusionAuth - Identity Without Constraints
        https://fusionauth.io

        1 Reply Last reply
        Reply Quote 0
        • J
          julien.sarriot
          last edited by

          @dan I have the same error, it seem that fusionauth just throw the same error when:

          • authorization code is invalid
          • code_verifier is invalid (good format but not corresponding to code_challenge)

          When I look at logs on fusionauth interface, I see good errors but not on http response.
          (I'm using 1.40.1)

          danD 1 Reply Last reply
          Reply Quote 0
          • danD
            dan @julien.sarriot
            last edited by

            @julien-sarriot What does turning on the debug log do? https://fusionauth.io/docs/v1/tech/admin-guide/troubleshooting#enabling-debugging has instructions on how to do that and where to look after (in the event log).

            Please share that info here.

            --
            FusionAuth - Identity Without Constraints
            https://fusionauth.io

            1 Reply Last reply
            Reply Quote 0

            Hello! It looks like you're interested in this conversation, but you don't have an account yet.

            Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.

            With your input, this post could be even better 💗

            Register Login
            • First post
              Last post