@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 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: ["openid", "profile", "email"],
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, ["openid", "profile", "email"]);
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
@@ -1,4 +1,5 @@
1
1
  export declare const TENSORGRAD_ISSUER = "https://www.tensorgrad.com";
2
+ export declare const DEFAULT_TG_SCOPES: readonly ["openid", "profile", "email"];
2
3
  export interface tgOAuthConfig {
3
4
  issuer: string;
4
5
  clientId: string;
package/dist/index.js CHANGED
@@ -1,4 +1,5 @@
1
1
  export const TENSORGRAD_ISSUER = "https://www.tensorgrad.com";
2
+ export const DEFAULT_TG_SCOPES = ["openid", "profile", "email"];
2
3
  const MIN_STATE_BYTES = 16;
3
4
  const MAX_RANDOM_BYTES = 96;
4
5
  const MIN_PKCE_RANDOM_BYTES = 32;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tensorgrad/oauth",
3
- "version": "0.1.0",
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"