Forum Discussion

vimala_palanisamy22's avatar
vimala_palanisamy22
Explorer | Level 3
4 years ago

Error while generating token

I am trying to generate access token with the api https://api.dropbox.com/oauth2/token but i m getting error like {"error": "invalid_request", "error_description": "Can't use \"Authorization\" header and \"client_secret\" arg together."}|__|0=https://api.dropbox.com/oauth2/token|__|1={"error": "invalid_request", "error_description": "Can't use \"Authorization\" header and \"client_secret\" arg together."} But we didnt pass any header while calling token api

1 Reply

  • Greg-DB's avatar
    Greg-DB
    Icon for Dropbox Community Moderator rankDropbox Community Moderator
    4 years ago

    I just tried out this flow and it seems to be working correctly for me. Here's a sample of what I ran (with values redacted):

    # https://www.dropbox.com/oauth2/authorize?client_id=APPKEY&response_type=code&token_access_type=offline
    
    curl https://api.dropbox.com/oauth2/token \
        -d code=AUTHORIZATIONCODE \
        -d grant_type=authorization_code \
        -d client_id=APPKEY \
        -d client_secret=APPSECRET
    
    # {
    #   "access_token": "ACCESSTOKEN",
    #   "token_type": "bearer",
    #   "expires_in": 14400,
    #   "refresh_token": "RERESHTOKEN",
    #   "uid": "USERID",
    #   "account_id": "ACCOUNTID"
    # }
    
    curl https://api.dropbox.com/oauth2/token \
        -d refresh_token=RERESHTOKEN \
        -d grant_type=refresh_token \
        -d client_id=APPKEY \
        -d client_secret=APPSECRET
    
    # {
    #   "access_token": "NEWACCESSTOKEN",
    #   "token_type": "bearer",
    #   "expires_in": 14400
    # }
    

     

    If that isn't working properly for you, please share the steps and code to reproduce the issue so we can look into it.

About Dropbox API Support & Feedback

Node avatar for Dropbox API Support & Feedback
Find help with the Dropbox API from other developers.

The Dropbox Community team is active from Monday to Friday. We try to respond to you as soon as we can, usually within 2 hours.

If you need more help you can view your support options (expected response time for an email or ticket is 24 hours), or contact us on X, Facebook or Instagram.

For more info on available support options for your Dropbox plan, see this article.

If you found the answer to your question in this Community thread, please 'like' the post to say thanks and to let us know it was useful!