![Oracle Drags Its Feet in the JavaScript Trademark Dispute](https://cdn.sanity.io/images/cgdhsj6q/production/919c3b22c24f93884c548d60cbb338e819ff2435-1024x1024.webp?w=400&fit=max&auto=format)
Security News
Oracle Drags Its Feet in the JavaScript Trademark Dispute
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.
@sp-api-sdk/auth
Advanced tools
@sp-api-sdk/auth
Amazon Selling Partner API authentication package
npm install @sp-api-sdk/auth
These constructor options can be passed using environment variables:
Property Name | Environement variable |
---|---|
clientId | LWA_CLIENT_ID |
clientSecret | LWA_CLIENT_SECRET |
refreshToken | LWA_REFRESH_TOKEN |
Some APIs require grantless authentication, which is done by passing scopes, instead of a refresh token.
The available scopes are exposed in the AuthorizationScope
enum from this library.
import { SellingPartnerApiAuth, AuthorizationScope } from "@sp-api-sdk/auth";
import { AuthorizationApiClient } from "@sp-api-sdk/authorization-api-v1";
const auth = new SellingPartnerApiAuth({
clientId: "",
clientSecret: "",
scopes: [AuthorizationScope.NOTIFICATIONS, AuthorizationScope.CLIENT_CREDENTIAL_ROTATION], // Or choose the only ones you need
});
const accessToken = await auth.getAccessToken();
getAccessToken()
caches the access token in memory for its whole duration, it will only request a new token if the current one has expired.
You can subclass SellingPartnerApiAuth
to add custom logic, for example, caching the access token in a store.
import { SellingPartnerApiAuth } from "@sp-api-sdk/auth";
import { storeToken, getToken } from "./token-store";
class StoredSellingPartnerApiAuth extends SellingPartnerApiAuth {
async getAccessToken() {
let token = await getToken();
if (token) {
return token;
}
token = await super.getAccessToken();
await storeToken(token, { ttl: this.accessTokenExpiration });
return token;
}
}
MIT
╚⊙ ⊙╝
╚═(███)═╝
╚═(███)═╝
╚═(███)═╝
╚═(███)═╝
╚═(███)═╝
╚═(███)═╝
FAQs
Amazon Selling Partner API authentication package
The npm package @sp-api-sdk/auth receives a total of 0 weekly downloads. As such, @sp-api-sdk/auth popularity was classified as not popular.
We found that @sp-api-sdk/auth demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
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.
Security News
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.
Security News
The Linux Foundation is warning open source developers that compliance with global sanctions is mandatory, highlighting legal risks and restrictions on contributions.
Security News
Maven Central now validates Sigstore signatures, making it easier for developers to verify the provenance of Java packages.