Start 2025 on time and up to date. Seamlessly integrate your calendars into Dropbox with these simple steps.

Forum Discussion

ancso's avatar
ancso
Helpful | Level 6
4 years ago

Can't get PKCE access token uses javascript fetch request

I am trying to utilize the PKCE in a background script of chrome extension example shows the following:   curl https://api.dropbox.com/oauth2/token \ -d code=<AUTHORIZATION_CODE> \ -d grant_typ...
  • ancso's avatar
    ancso
    4 years ago

    yes!
    that was the problem
    my apologies I missed these arguments in the request URL

     

    however,
    i am now getting the error 

     

    {error: 'invalid_grant', error_description: 'invalid code verifier'}

     

     

    The URL includes both code_challenge and code_challenge_method
    and looks like:

     

    https://www.dropbox.com/oauth2/authorize?response_type=code&client_id=<client_id>&code_challenge=<code_challenge>&code_challenge_method=S256

     


    and the parameters sent to oauth2/token are:

     

    client_id=<client_id>&grant_type=authorization_code&code=<auth code from dropbox>&code_verifier=<128 char verifier>

     

     

    i also made sure that <code challenge> is a SHA256 hash of <128 char verifier> by testing it at https://emn178.github.io/online-tools/sha256.html

    what am i missing?