@commercelayer/js-auth
Advanced tools
Comparing version 2.2.9 to 3.0.0
{ | ||
"name": "@commercelayer/js-auth", | ||
"version": "2.2.9", | ||
"version": "3.0.0", | ||
"description": "Commerce Layer Javascript Auth", | ||
@@ -12,4 +12,4 @@ "repository": { | ||
}, | ||
"main": "lib/cjs/index.js", | ||
"module": "lib/esm/index.js", | ||
"module": "lib/index.js", | ||
"types": "lib/index.d.ts", | ||
"files": [ | ||
@@ -34,3 +34,4 @@ "lib", | ||
"test:coverage": "jest --coverage", | ||
"build": "tsc -b tsconfig.json tsconfig.esm.json --v", | ||
"build": "tsc -b tsconfig.json --v", | ||
"lint": "eslint src", | ||
"postbuild": "minimize-js lib -w -s", | ||
@@ -83,4 +84,4 @@ "version:patch": "npm version patch", | ||
"devDependencies": { | ||
"@babel/preset-env": "^7.16.5", | ||
"@babel/preset-typescript": "^7.16.5", | ||
"@babel/preset-env": "^7.16.11", | ||
"@babel/preset-typescript": "^7.16.7", | ||
"@semantic-release/changelog": "^6.0.1", | ||
@@ -90,12 +91,15 @@ "@semantic-release/commit-analyzer": "^9.0.2", | ||
"@semantic-release/github": "^8.0.2", | ||
"@semantic-release/npm": "^8.0.3", | ||
"@semantic-release/npm": "^9.0.0", | ||
"@semantic-release/release-notes-generator": "^10.0.3", | ||
"@types/jest": "^27.0.3", | ||
"@types/mocha": "^9.0.0", | ||
"dotenv": "^10.0.0", | ||
"jest": "^27.4.5", | ||
"@types/jest": "^27.4.0", | ||
"@types/mocha": "^9.1.0", | ||
"@typescript-eslint/eslint-plugin": "^5.11.0", | ||
"dotenv": "^16.0.0", | ||
"eslint": "^8.8.0", | ||
"eslint-plugin-react": "^7.28.0", | ||
"jest": "^27.5.1", | ||
"minimize-js": "^1.2.0", | ||
"semantic-release": "^18.0.1", | ||
"typescript": "^4.5.4" | ||
"semantic-release": "^19.0.2", | ||
"typescript": "^4.5.5" | ||
} | ||
} |
# Commerce Layer JS Auth | ||
A JavaScript Library wrapper that helps you use the Commerce Layer API for [Authentication](https://docs.commercelayer.io/api/authentication). | ||
A JavaScript Library wrapper that helps you use the Commerce Layer API for [Authentication](https://docs.commercelayer.io/developers/authentication). | ||
@@ -12,3 +12,3 @@ ## What is Commerce Layer? | ||
- [Getting started](#getting-started) | ||
- [Installation](#installation) | ||
- [Installation](#installation) | ||
- [Using E6 import](#using-es6-import) | ||
@@ -63,3 +63,2 @@ - [Authorization flows](#authorization-flows) | ||
## Authorization flows | ||
@@ -78,3 +77,3 @@ | ||
Check our [API reference](https://docs.commercelayer.io/api/authentication) for further information on each single authorization flow. | ||
Check our [documentation](https://docs.commercelayer.io/developers/authentication) for further information on each single authorization flow. | ||
@@ -92,3 +91,3 @@ ## Use cases | ||
Sales channel applications use the [client credentials](https://docs.commercelayer.io/api/authentication/client-credentials) grant type to get a "guest" access token. | ||
Sales channel applications use the [client credentials](https://docs.commercelayer.io/developers/authentication/client-credentials) grant type to get a "guest" access token. | ||
@@ -114,3 +113,3 @@ #### Steps | ||
Sales channel applications can use the [password](https://docs.commercelayer.io/api/authentication/password) grant type to exchange a customer credentials for an access token (i.e., to get a "logged" access token). | ||
Sales channel applications can use the [password](https://docs.commercelayer.io/developers/authentication/password) grant type to exchange a customer credentials for an access token (i.e., to get a "logged" access token). | ||
@@ -140,3 +139,3 @@ #### Steps | ||
Sales channel applications can use the [refresh token](https://docs.commercelayer.io/api/authentication/refresh-token) grant type to refresh a customer access token with a "remember me" option. So, in this case, if the token is expired, you can refresh it by using the `refresh()` method: | ||
Sales channel applications can use the [refresh token](https://docs.commercelayer.io/developers/authentication/refresh-token) grant type to refresh a customer access token with a "remember me" option. So, in this case, if the token is expired, you can refresh it by using the `refresh()` method: | ||
@@ -147,2 +146,14 @@ ``` | ||
console.log('New access token: ', newToken.accessToken) | ||
// or | ||
const newToken = await getRefreshToken( | ||
{ | ||
clientId: 'your-client-id', | ||
endpoint: 'https://yourdomain.commercelayer.io', | ||
scope: 'market:{id}', | ||
refreshToken: 'your-refresh-token' | ||
} | ||
) | ||
``` | ||
@@ -152,3 +163,3 @@ | ||
Integration applications use the [client credentials](https://docs.commercelayer.io/api/authentication/client-credentials) grant type to get an access token for themselves. | ||
Integration applications use the [client credentials](https://docs.commercelayer.io/developers/authentication/client-credentials) grant type to get an access token for themselves. | ||
@@ -176,3 +187,3 @@ #### Steps | ||
Webapp applications use the [authorization code](https://docs.commercelayer.io/api/authentication/authorization-code) grant type to exchange an authorization code for an access token. | ||
Webapp applications use the [authorization code](https://docs.commercelayer.io/developers/authentication/authorization-code) grant type to exchange an authorization code for an access token. | ||
@@ -197,7 +208,7 @@ #### Steps | ||
3. Once you've authorized the application, you will be redirected to the callback URL: | ||
3. Once you've authorized the application, you will be redirected to the callback URL: | ||
![Callback URL with Authorization Code](docs/images/auth-code-browser.jpg?raw=true "Callback URL with Authorization Code") | ||
![Callback URL with Authorization Code](docs/images/auth-code-browser.jpg?raw=true 'Callback URL with Authorization Code') | ||
Use this code to get the access token: | ||
Use this code to get the access token: | ||
@@ -236,3 +247,3 @@ ``` | ||
1. Request an invite to join [Commerce Layer's Slack community](https://commercelayer.io/developers) (kindly scroll down to the bottom of the page). | ||
1. Request an invite to join [Commerce Layer's Slack community](https://slack.commercelayer.app/). | ||
@@ -239,0 +250,0 @@ 2. Create an [issue](https://github.com/commercelayer/commercelayer-js-auth/issues) in this repository. |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
Minified code
QualityThis package contains minified code. This may be harmless in some cases where minified code is included in packaged libraries, however packages on npm should not minify code.
Found 3 instances in 1 package
0
246
20051
18
20
109