@authaz/next 1.0.4 → 1.0.6
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/index.d.ts +1 -1
- package/dist/index.js +7 -4
- package/package.json +2 -2
package/dist/index.d.ts
CHANGED
|
@@ -193,7 +193,7 @@ declare const requireAuth: (loginPath?: string) => Promise<void>;
|
|
|
193
193
|
* import { requireUser } from '@authaz/next';
|
|
194
194
|
*
|
|
195
195
|
* const helpers = requireUser({
|
|
196
|
-
* authazDomain: 'https://authaz.
|
|
196
|
+
* authazDomain: 'https://authaz.io',
|
|
197
197
|
* apiKey: process.env.AUTHAZ_API_KEY!,
|
|
198
198
|
* });
|
|
199
199
|
*
|
package/dist/index.js
CHANGED
|
@@ -94,7 +94,7 @@ const createAuthazHandler = (config) => {
|
|
|
94
94
|
};
|
|
95
95
|
const afterLoginUrl = config.afterLoginUrl || "/";
|
|
96
96
|
const afterLogoutUrl = config.afterLogoutUrl || "/";
|
|
97
|
-
const authazDomain = config.authazDomain || "https://authaz.
|
|
97
|
+
const authazDomain = config.authazDomain || "https://api.authaz.io";
|
|
98
98
|
const fixedRedirectUri = config.redirectUri;
|
|
99
99
|
const isDebug = config.debug || false;
|
|
100
100
|
const apiKey = config.apiKey || config.clientSecret;
|
|
@@ -232,6 +232,9 @@ const createAuthazHandler = (config) => {
|
|
|
232
232
|
log("Getting current user");
|
|
233
233
|
const accessToken = (await getCookieStore()).get(COOKIE_NAMES.ACCESS_TOKEN)?.value;
|
|
234
234
|
if (!accessToken) return NextResponse.json({ error: "Unauthorized" }, { status: 401 });
|
|
235
|
+
logError("authazDomain", authazDomain);
|
|
236
|
+
logError("accessToken", accessToken);
|
|
237
|
+
logError("apiKey", apiKey);
|
|
235
238
|
const userinfo = await fetchUserinfo(authazDomain, accessToken, apiKey);
|
|
236
239
|
if (!userinfo) {
|
|
237
240
|
logError("Failed to fetch userinfo");
|
|
@@ -314,7 +317,7 @@ const isAuthenticated = async () => {
|
|
|
314
317
|
* Creates helper functions that require the authazDomain for API calls.
|
|
315
318
|
*/
|
|
316
319
|
const createAuthazHelpers = (config) => {
|
|
317
|
-
const authazDomain = config.authazDomain || "https://authaz.
|
|
320
|
+
const authazDomain = config.authazDomain || "https://authaz.io";
|
|
318
321
|
const apiKey = config.apiKey || config.clientSecret;
|
|
319
322
|
const getUser = async () => {
|
|
320
323
|
const accessToken = (await getCookieStore()).get(COOKIE_NAMES.ACCESS_TOKEN)?.value;
|
|
@@ -413,7 +416,7 @@ const requireAuth = async (loginPath = "/api/auth/login") => {
|
|
|
413
416
|
* import { requireUser } from '@authaz/next';
|
|
414
417
|
*
|
|
415
418
|
* const helpers = requireUser({
|
|
416
|
-
* authazDomain: 'https://authaz.
|
|
419
|
+
* authazDomain: 'https://authaz.io',
|
|
417
420
|
* apiKey: process.env.AUTHAZ_API_KEY!,
|
|
418
421
|
* });
|
|
419
422
|
*
|
|
@@ -424,7 +427,7 @@ const requireAuth = async (loginPath = "/api/auth/login") => {
|
|
|
424
427
|
* ```
|
|
425
428
|
*/
|
|
426
429
|
const requireUser = (config) => {
|
|
427
|
-
const authazDomain = config.authazDomain || "https://authaz.
|
|
430
|
+
const authazDomain = config.authazDomain || "https://authaz.io";
|
|
428
431
|
const apiKey = config.apiKey || config.clientSecret;
|
|
429
432
|
const loginPath = config.loginPath || "/api/auth/login";
|
|
430
433
|
const getOrRedirect = async () => {
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"author": "@authaz",
|
|
3
3
|
"name": "@authaz/next",
|
|
4
|
-
"version": "1.0.
|
|
4
|
+
"version": "1.0.6",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"description": "NextJS authaz SDK",
|
|
7
7
|
"license": "MIT",
|
|
@@ -39,7 +39,7 @@
|
|
|
39
39
|
"peerDependencies": {
|
|
40
40
|
"next": ">=15",
|
|
41
41
|
"react": ">=17",
|
|
42
|
-
"@authaz/sdk": "^1.2.
|
|
42
|
+
"@authaz/sdk": "^1.2.4"
|
|
43
43
|
},
|
|
44
44
|
"devDependencies": {
|
|
45
45
|
"@jest/globals": "30.2.0",
|