1.3.3 • Published 4 years ago

oauth-ebay v1.3.3

Weekly downloads
-
License
ISC
Repository
github
Last release
4 years ago

Ebay Oauth API

Fetch Oauth token for Ebay developer REST Api's using node js.

npm version Build Status

**NOT MAINTAINED*** eBay officially published oauth module, kindly refer here https://github.com/eBay/ebay-oauth-nodejs-client]

Installation

npm install oauth-ebay

or

yarn add oauth-ebay

Oauth Access Tokens

Client credentials grant

Options

const ebayAuthToken = new EbayAuthToken({
    clientId: "-- ClientID -- ", // required
    clientSecret: "-- Client Secret --", // required
    grantType: "-- Grant type --", // optional
    scope: scopes, // array of scopes,
    state: '', // optional
    env: "PROD" // either SANDBOX or PROD (Default Value = PROD)
})

Example

ebayAuthToken.getAccessToken().then((data) => {
    console.log(data);
}).catch((error) => {
    console.log(`Error to get Access token :${JSON.stringify(error)}`);
});

Authorization code grant

Options

const ebayAuthToken = new EbayAuthToken({ 
    clientId: "-- ClientID -- ", // required
    clientSecret: "-- Client Secret --", // required
    grantType: "-- Grant type --", // optional
    scope: scopes,
    redirectUri: "-- redirect uri app name --" // required for getting user consent url.
})
  • Get User consent url
const userConsentUrl = ebayAuthToken.getUserConsentUrl();
  • Open the userConsentUrl in the browser, which allows you to login in to ebay site. You will get a authorization code.

or if you are using express use res.direct(userConsentUrl);

  • pass the authorization code got in the above step to getAuthorizationCodeToken method
ebayAuthToken.getAuthorizationCodeToken(code).then((data) => {
    console.log(data);
}).catch((error) => {
    console.log(`Error to get Access token :${JSON.stringify(error)}`);
});

Refresh token to update a User access token

ebayAuthToken.getAccessTokenWithRefresh(refresh_token).then((data) => {
    console.log(data);
}).catch((error) => {
    console.log(`Error to get Access token from refresh token:${JSON.stringify(error)}`);
});

Examples

Click here

Issues

you can create issues or propose improvements here Click here

Useful links

Getting Client Id and Client Secret

https://developer.ebay.com/api-docs/static/oauth-credentials.html

Getting your redirect_uri value

https://developer.ebay.com/api-docs/static/oauth-redirect-uri.html

Specifying right scopes

https://developer.ebay.com/api-docs/static/oauth-scopes.html
1.3.3

4 years ago

1.3.2

5 years ago

1.3.1

5 years ago

1.3.0

5 years ago

1.2.1

5 years ago

1.2.0

5 years ago

1.1.0

5 years ago

1.0.0

5 years ago