Jump to content

Authorization Problem


Recommended Posts


I have some code (c#) working which retrieves an authorization code using clientid and secret values. I am then trying to exchange this code (which was stored in a string variable) for access and refresh tokens. The request body is being built thus:


The value for code is taken from a variable into which the code value as retrieved from the initial authorization call. The redirecturi, clientid and clientsecret values are taken from the same variables used in the initial authorization code call. And yet this second call fails with the attached message. I can't understand why given that the values it's complaining about are simply coming from the same variables both times?


Reg Jackson

Screenshot 2021-02-19 164901.jpg

Link to comment
Share on other sites

Hi Reginald, thank you for your question.

To clarify, are you attempting to exchange a refresh_token for an access_token? If this is correct you need to make a POST request to the token endpoint https://oauth.accounting.sage.com/token with the following attributes:

Content-Type: application/x-www-form-urlencoded


The Content_Type attribute should be set in the request header and the client_id, client_secret, grant_type and refresh_token set in the request body. I extracted the above from our Auth guide which offers a complete overview of the process.



Link to comment
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in

Sign In Now

  • Create New...