bhushankummar / eBay-node-client

Ebay NodeJS Wrapper
MIT License
54 stars 66 forks source link

How do you get the code in retrieveUserToken.js example? #33

Closed doverradio closed 2 years ago

doverradio commented 4 years ago

Hello, I'm trying again to use your library to retrieve a user code and it's not working.

Please see this snippet from your example from here:

var userRequest = async function () {
    var token = {};
    try {
        var options = {
            redirectURI: 'Bhushankumar_L-Bhushank-DemoAp-onqph',
            code: 'v^1.1#i^1#f^0#r^1#p^3#I^3#t^Ul41Xzg6QTgwNEM4REE5RDUwODMyNzgyNjJFNUVBRTk1OTQ3QzlfMl8xI0VeMTI4NA=='
        };

I found where to get my redirectURI but not where to get the code. You have put some value for code. Where do I get this for mine? Every time I run it's not working, most likely due to having wrong code. Can you please help?

ipengli commented 4 years ago

I think the code is get from ebay after user authorised successfully. Pls ref https://developer.ebay.com/api-docs/static/oauth-auth-code-grant-request.html#:~:text=When%20a%20user%20grants%20your,an%20authorization%20code%20grant%20request.

pajaydev commented 4 years ago

@doverradio there is official ebay oauth node module, you can use that to get the code and generate the token https://github.com/eBay/ebay-oauth-nodejs-client/blob/master/demo/example.js#L55