question

komodo-electronics avatar image
0 Likes"
komodo-electronics asked ·

oauth token issues

I am trying to implement oauth2 for the new Finance functionality. I can get a user consent code just fine, but every time I try and mint a user auth token I get the following error: "the provided authorization grant code is invalid or was issued to another client" I can see others are having similar issues - anyone know how to sort this? For some reason I don't seem to be able to respond to other peoples threads on this forum also? Dim UserTokenClient As RestClient = New RestClient(" https://api.ebay.com/identity/v1/oauth2/token";) Dim UserTokenRequest As RestRequest = New RestRequest() UserTokenRequest.AddHeader("Content-Type", "application/x-www-form-urlencoded") UserTokenRequest.AddHeader("Authorization", "Basic " & Convert.ToBase64String(System.Text.ASCIIEncoding.ASCII.GetBytes(ClientId & ":" & ClientSecret))) UserTokenRequest.AddParameter("grant_type", "authorization_code") UserTokenRequest.AddParameter("redirect_uri", ClientId) UserTokenRequest.AddParameter("code", HttpUtility.UrlEncode(UserAccessToken)) Dim AccessTokenResponse = UserTokenClient.Post(UserTokenRequest) ,
oauth2
10 |600 characters needed characters left characters exceeded

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

nochkin avatar image
0 Likes"
nochkin answered ·
My RuName starts with my company name, while CertId prefixed with "PRD-". These are not the same for sure. I'm not that familiar with VB Rest code you are using, but here is what I found for you: https://stackoverflow.com/questions/49521478/rest-client-basic-authorization-to-a-rest-api Hopefully that will give you some ideas ,I'm not that familiar with VB Rest code you are using, but here is what I found for you: https://stackoverflow.com/questions/49521478/rest-client-basic-authorization-to-a-rest-api Check the answer for the sample code. Hopefully that will give you some ideas.
· Share
10 |600 characters needed characters left characters exceeded

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

komodo-electronics avatar image
0 Likes"
komodo-electronics answered ·
Oops... left over from messing around. Even with the proper RuName in there it still gives the same error. If I don't include a RuName at all I get the 'malformed' error back. If I do include I get the another client message - the RuName and ClientId are the exact same ones used in the call to get the user consent so I really don't get why it is returning this?
· Share
10 |600 characters needed characters left characters exceeded

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

nochkin avatar image
0 Likes"
nochkin answered ·
Your line where you set "redirect_uri" does not look valid. You set it to your ClientId, but it should be your RuName.
· Share
10 |600 characters needed characters left characters exceeded

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.