@authu/react 1.0.54 → 1.0.56
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/dist/AuthUProvider.d.ts.map +1 -1
- package/dist/AuthUProvider.js +14 -6
- package/dist/index.d.ts +3 -3
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -2
- package/package.json +6 -10
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AuthUProvider.d.ts","sourceRoot":"","sources":["../src/AuthUProvider.tsx"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"AuthUProvider.d.ts","sourceRoot":"","sources":["../src/AuthUProvider.tsx"],"names":[],"mappings":"AAAA,OAAO,EAEL,KAAK,SAAS,EAIf,MAAM,OAAO,CAAC;AAef,OAAO,KAAK,EAEV,WAAW,EACX,iBAAiB,EAElB,MAAM,YAAY,CAAC;AAEpB,eAAO,MAAM,YAAY,mDAAgD,CAAC;AAO1E,UAAU,kBAAkB;IAC1B,MAAM,EAAE,WAAW,CAAC;IACpB,QAAQ,EAAE,SAAS,CAAC;CACrB;AAID,wBAAgB,aAAa,CAAC,EAAC,MAAM,EAAE,QAAQ,EAAC,EAAE,kBAAkB,2CAqcnE"}
|
package/dist/AuthUProvider.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
import { createContext, useEffect, useState
|
|
3
|
-
import {
|
|
2
|
+
import { createContext, useCallback, useEffect, useState } from 'react';
|
|
3
|
+
import { clearCodeVerifier, clearNonce, clearState, generateCodeChallenge, generateCodeVerifier, generateNonce, generateState, getCodeVerifier, getStoredState, storeCodeVerifier, storeNonce, storeState } from './pkce.js';
|
|
4
4
|
export const AuthUContext = createContext(null);
|
|
5
5
|
function buildBaseUrl(domain) {
|
|
6
6
|
const protocol = domain.startsWith('localhost') ? 'http' : 'https';
|
|
@@ -64,7 +64,7 @@ export function AuthUProvider({ config, children }) {
|
|
|
64
64
|
}
|
|
65
65
|
return response.json();
|
|
66
66
|
}, [config]);
|
|
67
|
-
const parseIdToken = (idToken) => {
|
|
67
|
+
const parseIdToken = useCallback((idToken) => {
|
|
68
68
|
const parts = idToken.split('.');
|
|
69
69
|
if (parts.length !== 3) {
|
|
70
70
|
throw new Error('Invalid ID token');
|
|
@@ -77,7 +77,7 @@ export function AuthUProvider({ config, children }) {
|
|
|
77
77
|
name: payload.name,
|
|
78
78
|
picture: payload.picture
|
|
79
79
|
};
|
|
80
|
-
};
|
|
80
|
+
}, []);
|
|
81
81
|
const login = useCallback(async (options) => {
|
|
82
82
|
const url = await getAuthorizationUrl(options);
|
|
83
83
|
console.log('[AuthU SDK] login() called, redirecting to:', url);
|
|
@@ -153,7 +153,14 @@ export function AuthUProvider({ config, children }) {
|
|
|
153
153
|
logout();
|
|
154
154
|
return false;
|
|
155
155
|
}
|
|
156
|
-
}, [
|
|
156
|
+
}, [
|
|
157
|
+
state.refreshToken,
|
|
158
|
+
state.user,
|
|
159
|
+
config.domain,
|
|
160
|
+
config.clientId,
|
|
161
|
+
logout,
|
|
162
|
+
parseIdToken
|
|
163
|
+
]);
|
|
157
164
|
const getAccessToken = useCallback(async () => {
|
|
158
165
|
if (!state.accessToken)
|
|
159
166
|
return null;
|
|
@@ -307,7 +314,8 @@ export function AuthUProvider({ config, children }) {
|
|
|
307
314
|
exchangeCodeForTokensWithVerifier,
|
|
308
315
|
fetchUserInfo,
|
|
309
316
|
config.clientId,
|
|
310
|
-
config.domain
|
|
317
|
+
config.domain,
|
|
318
|
+
parseIdToken
|
|
311
319
|
]);
|
|
312
320
|
const checkEmailExists = useCallback(async (email) => {
|
|
313
321
|
try {
|
package/dist/index.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
export { AuthUProvider } from './AuthUProvider.js';
|
|
2
|
-
export { useAuthU } from './useAuthU.js';
|
|
3
|
-
export { useApiToken } from './useApiToken.js';
|
|
4
2
|
export { PrivateRoute } from './PrivateRoute.js';
|
|
5
3
|
export * from './pkce.js';
|
|
6
|
-
export type { AuthUConfig,
|
|
4
|
+
export type { AuthUConfig, AuthUContextValue, AuthUUser } from './types.js';
|
|
5
|
+
export { useApiToken } from './useApiToken.js';
|
|
6
|
+
export { useAuthU } from './useAuthU.js';
|
|
7
7
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,aAAa,EAAC,MAAM,oBAAoB,CAAC;AACjD,OAAO,EAAC,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,aAAa,EAAC,MAAM,oBAAoB,CAAC;AACjD,OAAO,EAAC,YAAY,EAAC,MAAM,mBAAmB,CAAC;AAC/C,cAAc,WAAW,CAAC;AAC1B,YAAY,EAAC,WAAW,EAAE,iBAAiB,EAAE,SAAS,EAAC,MAAM,YAAY,CAAC;AAC1E,OAAO,EAAC,WAAW,EAAC,MAAM,kBAAkB,CAAC;AAC7C,OAAO,EAAC,QAAQ,EAAC,MAAM,eAAe,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export { AuthUProvider } from './AuthUProvider.js';
|
|
2
|
-
export { useAuthU } from './useAuthU.js';
|
|
3
|
-
export { useApiToken } from './useApiToken.js';
|
|
4
2
|
export { PrivateRoute } from './PrivateRoute.js';
|
|
5
3
|
export * from './pkce.js';
|
|
4
|
+
export { useApiToken } from './useApiToken.js';
|
|
5
|
+
export { useAuthU } from './useAuthU.js';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@authu/react",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.56",
|
|
4
4
|
"description": "React SDK for AuthU - Centralized Multi-Tenant Authentication Service",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -18,9 +18,11 @@
|
|
|
18
18
|
"scripts": {
|
|
19
19
|
"build": "tsc",
|
|
20
20
|
"dev": "tsc --watch",
|
|
21
|
-
"
|
|
21
|
+
"lint": "biome check src && tsc --noEmit",
|
|
22
|
+
"lint:fix": "biome check --write src",
|
|
23
|
+
"format": "biome format --write src",
|
|
24
|
+
"format:check": "biome format --check src",
|
|
22
25
|
"typecheck": "tsc --noEmit",
|
|
23
|
-
"lint": "pnpm run eslint && pnpm run typecheck",
|
|
24
26
|
"prepublishOnly": "pnpm run build"
|
|
25
27
|
},
|
|
26
28
|
"keywords": [
|
|
@@ -38,14 +40,8 @@
|
|
|
38
40
|
"react": ">=18.0.0"
|
|
39
41
|
},
|
|
40
42
|
"devDependencies": {
|
|
41
|
-
"@eslint/js": "^9.36.0",
|
|
42
43
|
"@types/react": "^19.0.4",
|
|
43
|
-
"eslint": "^9.36.0",
|
|
44
|
-
"eslint-plugin-prettier": "^5.5.4",
|
|
45
|
-
"eslint-plugin-react-hooks": "^5.2.0",
|
|
46
|
-
"prettier": "^3.6.2",
|
|
47
44
|
"react": "^19.0.0",
|
|
48
|
-
"typescript": "^5.7.3"
|
|
49
|
-
"typescript-eslint": "^8.44.1"
|
|
45
|
+
"typescript": "^5.7.3"
|
|
50
46
|
}
|
|
51
47
|
}
|