Socket
Socket
Sign inDemoInstall

@sp-api-sdk/auth

Package Overview
Dependencies
165
Maintainers
2
Versions
82
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    @sp-api-sdk/auth

Auth library for helping authentication with Selling Partner API


Version published
Weekly downloads
279
decreased by-32.12%
Maintainers
2
Created
Weekly downloads
 

Readme

Source

@sp-api-sdk/auth

Package for simplifying authentication with Selling Partner API

Installing

  • yarn add @sp-api-sdk/auth
  • npm install @sp-api-sdk/auth

Usage

With Security Token Service :

import SellingPartnerApiAuth from '@sp-api-sdk/auth'

const auth = new SellingPartnerApiAuth({
  clientId: '',
  clientSecret: '',
  refreshToken: 'Atzr|...',
  accessKeyId: '',
  secretAccessKey,
  role: {
    arn: roleArn,
    sessionName: 'SellingPartnerAPI'
  },
})

const accessToken = await auth.accessToken.get()
const { AccessKeyId, SecretAccessKey, SessionToken } = await auth.getCredentials()

With an AWS user :

import SellingPartnerApiAuth from '@sp-api-sdk/auth'

const auth = new SellingPartnerApiAuth({
  clientId: '',
  clientSecret: '',
  refreshToken: 'Atzr|...',
  accessKeyId: '',
  secretAccessKey,
  user: {
    AccessKeyId: '',
    SecretAccessKey: ''
  }
})

const accessToken = await auth.accessToken.get()
const { AccessKeyId, SecretAccessKey } = await auth.getCredentials()

Everytime you get the access token, the class will check before if the token has already been fetch or if it's still valid, if not, it will fetch it.

Same for the given credentials from Security Token Service

Keywords

FAQs

Last updated on 26 May 2021

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc