question

lyvong_17 avatar image
0 Likes"
lyvong_17 asked ·

How to get the authorization code to exchange for user access token

Hi, I'm a new developer and its my first time working with OAuth2. Could someone advise me on the next steps into getting the authorization code that should be in the redirect URL link? Using eBay's library, I called OAuth2Api().GenerateUserAuthorizationUrl() where a URL string is returned that links to the consent page. How do i automate that in code that allows me to 'accept' consent & retrieve the authorization code that's embedded in the redirect URL? Attached is my method trying to get the authorization code to exchange for user access token (sorry i'm a noob so its not the greatest code).
oauth2authorization code granttoken key
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.

lyvong_17 avatar image
0 Likes"
lyvong_17 answered ·
Hi, Thank you, but I read through the documentation already. My question is if there's any way to automate the Grant Application Access page, the page where the user is supposed to 'agree' to consent? And I understand that once the user clicks 'agree' it redirects to the accept url where the authorization code is then appended at the end of the redirect url link. Do you have sample code or a method on how to 'agree' to user consent without having a pop up window, so not through UI, but simply to automate it through code? Or is there something else that I'm possibly missing???
· 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.

sagar_developersupport avatar image
0 Likes"
sagar_developersupport answered ·
Hi lyvong_17 , Please go through below document for :- 1. Refreshing oAuth token , REF:- https://developer.ebay.com/api-docs/static/oauth-refresh-token-request.html 2.Getting user consent , REF:- https://developer.ebay.com/api-docs/static/oauth-consent-request.html Please let me know if this helps you or need any further assistance . Best Regards, eBay Developer Support
· 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.