@tensorgrad/oauth 0.1.0 → 0.1.1
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 +4 -2
- package/dist/index.d.ts +1 -0
- package/dist/index.js +1 -0
- package/package.json +5 -1
package/README.md
CHANGED
|
@@ -45,6 +45,7 @@ console.log(TENSORGRAD_ISSUER);
|
|
|
45
45
|
|
|
46
46
|
```ts
|
|
47
47
|
import {
|
|
48
|
+
DEFAULT_TG_SCOPES,
|
|
48
49
|
TENSORGRAD_ISSUER,
|
|
49
50
|
assertGrantedScopes,
|
|
50
51
|
createAuthorizationUrl,
|
|
@@ -84,7 +85,7 @@ export default {
|
|
|
84
85
|
},
|
|
85
86
|
{
|
|
86
87
|
redirectUri,
|
|
87
|
-
scope:
|
|
88
|
+
scope: DEFAULT_TG_SCOPES,
|
|
88
89
|
state,
|
|
89
90
|
codeChallenge: pkce.codeChallenge,
|
|
90
91
|
codeChallengeMethod: pkce.codeChallengeMethod
|
|
@@ -125,7 +126,7 @@ export default {
|
|
|
125
126
|
codeVerifier
|
|
126
127
|
});
|
|
127
128
|
|
|
128
|
-
assertGrantedScopes(token.scope,
|
|
129
|
+
assertGrantedScopes(token.scope, DEFAULT_TG_SCOPES);
|
|
129
130
|
|
|
130
131
|
const userFromToken = normalizeTgUser(token.user);
|
|
131
132
|
const userFromUserInfo = normalizeTgUser(
|
|
@@ -149,6 +150,7 @@ export default {
|
|
|
149
150
|
|
|
150
151
|
- `openid` is mandatory and the library enforces that when building authorize URLs.
|
|
151
152
|
- tensorGrad currently uses `https://www.tensorgrad.com` as the OAuth provider.
|
|
153
|
+
- `DEFAULT_TG_SCOPES` is the recommended scope set for first-party apps.
|
|
152
154
|
- `assertGrantedScopes(token.scope, ["admin"])` is the simplest way to require admin access.
|
|
153
155
|
- `isAdminScopeGranted(token.scope)` is available when you only need a boolean check.
|
|
154
156
|
- app session and logout handling stay in the consuming app.
|
package/dist/index.d.ts
CHANGED
package/dist/index.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tensorgrad/oauth",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.1",
|
|
4
4
|
"description": "Small OAuth client SDK for tensorGrad SSO integrations.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -27,6 +27,10 @@
|
|
|
27
27
|
"tensorgrad",
|
|
28
28
|
"sso"
|
|
29
29
|
],
|
|
30
|
+
"repository": {
|
|
31
|
+
"type": "git",
|
|
32
|
+
"url": "https://github.com/tensorGrad/tgAuth"
|
|
33
|
+
},
|
|
30
34
|
"license": "MIT",
|
|
31
35
|
"devDependencies": {
|
|
32
36
|
"typescript": "^5.9.2"
|