@shoplygg/node 0.1.1 → 0.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +17 -0
- package/generated/api.d.ts +1304 -47
- package/generated/operations.js +32 -3
- package/index.d.ts +43 -1
- package/index.js +134 -4
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -75,4 +75,21 @@ await buyer.verify({ email, code });
|
|
|
75
75
|
const me = await buyer.show();
|
|
76
76
|
```
|
|
77
77
|
|
|
78
|
+
## OAuth
|
|
79
|
+
|
|
80
|
+
An app that sellers connect to their own stores gets a token by OAuth, and passes it as `apiKey`.
|
|
81
|
+
|
|
82
|
+
```js
|
|
83
|
+
import Shoply, { oauth } from "@shoplygg/node";
|
|
84
|
+
|
|
85
|
+
const pkce = await oauth.pkce();
|
|
86
|
+
const url = oauth.authorizeUrl({ clientId, redirectUri, state, codeChallenge: pkce.challenge });
|
|
87
|
+
|
|
88
|
+
// Back at your redirect URL:
|
|
89
|
+
const token = await oauth.exchange({ clientId, clientSecret, code, redirectUri, codeVerifier: pkce.verifier });
|
|
90
|
+
const shoply = new Shoply({ apiKey: token.accessToken, storeId: token.storeId });
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
How apps work: https://docs.shoply.gg/guides/oauth
|
|
94
|
+
|
|
78
95
|
The whole guide: https://docs.shoply.gg/api-reference/node
|