@propelauth/nextjs
Advanced tools
Comparing version 0.0.110 to 0.0.111
@@ -429,5 +429,2 @@ "use strict"; | ||
function getRouteHandlers(args) { | ||
const authUrlOrigin = getAuthUrlOrigin(); | ||
const redirectUri = getRedirectUri(); | ||
const integrationApiKey = getIntegrationApiKey(); | ||
function loginGetHandler(req) { | ||
@@ -442,2 +439,3 @@ return signupOrLoginHandler(req, false); | ||
const state = randomState(); | ||
const redirectUri = getRedirectUri(); | ||
const authorizeUrlSearchParams = new URLSearchParams({ | ||
@@ -454,3 +452,6 @@ redirect_uri: redirectUri, | ||
if (returnToPath.startsWith("/")) { | ||
headers2.append("Set-Cookie", `${RETURN_TO_PATH_COOKIE_NAME}=${returnToPath}; Path=/; HttpOnly; Secure; SameSite=Lax; Max-Age=600`); | ||
headers2.append( | ||
"Set-Cookie", | ||
`${RETURN_TO_PATH_COOKIE_NAME}=${returnToPath}; Path=/; HttpOnly; Secure; SameSite=Lax; Max-Age=600` | ||
); | ||
} else { | ||
@@ -478,2 +479,5 @@ console.warn("return_to_path must start with /"); | ||
} | ||
const authUrlOrigin = getAuthUrlOrigin(); | ||
const redirectUri = getRedirectUri(); | ||
const integrationApiKey = getIntegrationApiKey(); | ||
const oauth_token_body = { | ||
@@ -503,5 +507,14 @@ redirect_uri: redirectUri, | ||
headers2.append("Location", returnToPath); | ||
headers2.append("Set-Cookie", `${ACCESS_TOKEN_COOKIE_NAME}=${accessToken}; Path=/; HttpOnly; Secure; SameSite=Lax`); | ||
headers2.append("Set-Cookie", `${REFRESH_TOKEN_COOKIE_NAME}=${data.refresh_token}; Path=/; HttpOnly; Secure; SameSite=Lax`); | ||
headers2.append("Set-Cookie", `${RETURN_TO_PATH_COOKIE_NAME}=; Path=/; HttpOnly; Secure; SameSite=Lax; Max-Age=0`); | ||
headers2.append( | ||
"Set-Cookie", | ||
`${ACCESS_TOKEN_COOKIE_NAME}=${accessToken}; Path=/; HttpOnly; Secure; SameSite=Lax` | ||
); | ||
headers2.append( | ||
"Set-Cookie", | ||
`${REFRESH_TOKEN_COOKIE_NAME}=${data.refresh_token}; Path=/; HttpOnly; Secure; SameSite=Lax` | ||
); | ||
headers2.append( | ||
"Set-Cookie", | ||
`${RETURN_TO_PATH_COOKIE_NAME}=; Path=/; HttpOnly; Secure; SameSite=Lax; Max-Age=0` | ||
); | ||
return new Response(null, { | ||
@@ -512,3 +525,5 @@ status: 302, | ||
} else if (response.status === 401) { | ||
console.error("Couldn't finish the login process for this user. This is most likely caused by an incorrect PROPELAUTH_API_KEY."); | ||
console.error( | ||
"Couldn't finish the login process for this user. This is most likely caused by an incorrect PROPELAUTH_API_KEY." | ||
); | ||
return new Response("Unexpected error", { status: 500 }); | ||
@@ -530,4 +545,10 @@ } else { | ||
const headers3 = new Headers(); | ||
headers3.append("Set-Cookie", `${ACCESS_TOKEN_COOKIE_NAME}=; Path=/; HttpOnly; Secure; SameSite=Lax; Max-Age=0`); | ||
headers3.append("Set-Cookie", `${REFRESH_TOKEN_COOKIE_NAME}=; Path=/; HttpOnly; Secure; SameSite=Lax; Max-Age=0`); | ||
headers3.append( | ||
"Set-Cookie", | ||
`${ACCESS_TOKEN_COOKIE_NAME}=; Path=/; HttpOnly; Secure; SameSite=Lax; Max-Age=0` | ||
); | ||
headers3.append( | ||
"Set-Cookie", | ||
`${REFRESH_TOKEN_COOKIE_NAME}=; Path=/; HttpOnly; Secure; SameSite=Lax; Max-Age=0` | ||
); | ||
return new Response("Unauthorized", { status: 401, headers: headers3 }); | ||
@@ -537,2 +558,3 @@ } | ||
const accessToken = refreshResponse.accessToken; | ||
const authUrlOrigin = getAuthUrlOrigin(); | ||
const path = `${authUrlOrigin}/propelauth/oauth/userinfo`; | ||
@@ -542,3 +564,3 @@ const response = yield fetch(path, { | ||
"Content-Type": "application/json", | ||
"Authorization": "Bearer " + accessToken | ||
Authorization: "Bearer " + accessToken | ||
} | ||
@@ -555,4 +577,10 @@ }); | ||
const headers3 = new Headers(); | ||
headers3.append("Set-Cookie", `${ACCESS_TOKEN_COOKIE_NAME}=${accessToken}; Path=/; HttpOnly; Secure; SameSite=Lax`); | ||
headers3.append("Set-Cookie", `${REFRESH_TOKEN_COOKIE_NAME}=${refreshToken}; Path=/; HttpOnly; Secure; SameSite=Lax`); | ||
headers3.append( | ||
"Set-Cookie", | ||
`${ACCESS_TOKEN_COOKIE_NAME}=${accessToken}; Path=/; HttpOnly; Secure; SameSite=Lax` | ||
); | ||
headers3.append( | ||
"Set-Cookie", | ||
`${REFRESH_TOKEN_COOKIE_NAME}=${refreshToken}; Path=/; HttpOnly; Secure; SameSite=Lax` | ||
); | ||
headers3.append("Content-Type", "application/json"); | ||
@@ -565,4 +593,10 @@ return new Response(JSON.stringify(jsonResponse), { | ||
const headers3 = new Headers(); | ||
headers3.append("Set-Cookie", `${ACCESS_TOKEN_COOKIE_NAME}=; Path=/; HttpOnly; Secure; SameSite=Lax; Max-Age=0`); | ||
headers3.append("Set-Cookie", `${REFRESH_TOKEN_COOKIE_NAME}=; Path=/; HttpOnly; Secure; SameSite=Lax; Max-Age=0`); | ||
headers3.append( | ||
"Set-Cookie", | ||
`${ACCESS_TOKEN_COOKIE_NAME}=; Path=/; HttpOnly; Secure; SameSite=Lax; Max-Age=0` | ||
); | ||
headers3.append( | ||
"Set-Cookie", | ||
`${REFRESH_TOKEN_COOKIE_NAME}=; Path=/; HttpOnly; Secure; SameSite=Lax; Max-Age=0` | ||
); | ||
return new Response(null, { | ||
@@ -594,4 +628,10 @@ status: 401, | ||
headers2.append("Location", path); | ||
headers2.append("Set-Cookie", `${ACCESS_TOKEN_COOKIE_NAME}=; Path=/; HttpOnly; Secure; SameSite=Lax; Max-Age=0`); | ||
headers2.append("Set-Cookie", `${REFRESH_TOKEN_COOKIE_NAME}=; Path=/; HttpOnly; Secure; SameSite=Lax; Max-Age=0`); | ||
headers2.append( | ||
"Set-Cookie", | ||
`${ACCESS_TOKEN_COOKIE_NAME}=; Path=/; HttpOnly; Secure; SameSite=Lax; Max-Age=0` | ||
); | ||
headers2.append( | ||
"Set-Cookie", | ||
`${REFRESH_TOKEN_COOKIE_NAME}=; Path=/; HttpOnly; Secure; SameSite=Lax; Max-Age=0` | ||
); | ||
return new Response(null, { | ||
@@ -609,4 +649,10 @@ status: 302, | ||
headers2.append("Location", path); | ||
headers2.append("Set-Cookie", `${ACCESS_TOKEN_COOKIE_NAME}=; Path=/; HttpOnly; Secure; SameSite=Lax; Max-Age=0`); | ||
headers2.append("Set-Cookie", `${REFRESH_TOKEN_COOKIE_NAME}=; Path=/; HttpOnly; Secure; SameSite=Lax; Max-Age=0`); | ||
headers2.append( | ||
"Set-Cookie", | ||
`${ACCESS_TOKEN_COOKIE_NAME}=; Path=/; HttpOnly; Secure; SameSite=Lax; Max-Age=0` | ||
); | ||
headers2.append( | ||
"Set-Cookie", | ||
`${REFRESH_TOKEN_COOKIE_NAME}=; Path=/; HttpOnly; Secure; SameSite=Lax; Max-Age=0` | ||
); | ||
return new Response(null, { | ||
@@ -632,6 +678,14 @@ status: 302, | ||
const headers3 = new Headers(); | ||
headers3.append("Set-Cookie", `${ACCESS_TOKEN_COOKIE_NAME}=; Path=/; HttpOnly; Secure; SameSite=Lax; Max-Age=0`); | ||
headers3.append("Set-Cookie", `${REFRESH_TOKEN_COOKIE_NAME}=; Path=/; HttpOnly; Secure; SameSite=Lax; Max-Age=0`); | ||
headers3.append( | ||
"Set-Cookie", | ||
`${ACCESS_TOKEN_COOKIE_NAME}=; Path=/; HttpOnly; Secure; SameSite=Lax; Max-Age=0` | ||
); | ||
headers3.append( | ||
"Set-Cookie", | ||
`${REFRESH_TOKEN_COOKIE_NAME}=; Path=/; HttpOnly; Secure; SameSite=Lax; Max-Age=0` | ||
); | ||
return new Response(null, { status: 200, headers: headers3 }); | ||
} | ||
const authUrlOrigin = getAuthUrlOrigin(); | ||
const integrationApiKey = getIntegrationApiKey(); | ||
const logoutBody = { refresh_token: refreshToken }; | ||
@@ -638,0 +692,0 @@ const url = `${authUrlOrigin}/api/backend/v1/logout`; |
134
package.json
{ | ||
"name": "@propelauth/nextjs", | ||
"version": "0.0.110", | ||
"exports": { | ||
"./server": { | ||
"browser": "./dist/server/index.mjs", | ||
"import": "./dist/server/index.mjs", | ||
"require": "./dist/server/index.js", | ||
"default": "./dist/server/index.mjs", | ||
"types": "./dist/server/index.d.ts" | ||
"name": "@propelauth/nextjs", | ||
"version": "0.0.111", | ||
"exports": { | ||
"./server": { | ||
"browser": "./dist/server/index.mjs", | ||
"import": "./dist/server/index.mjs", | ||
"require": "./dist/server/index.js", | ||
"default": "./dist/server/index.mjs", | ||
"types": "./dist/server/index.d.ts" | ||
}, | ||
"./server/app-router": { | ||
"browser": "./dist/server/app-router/index.mjs", | ||
"import": "./dist/server/app-router/index.mjs", | ||
"require": "./dist/server/app-router/index.js", | ||
"default": "./dist/server/app-router/index.mjs", | ||
"types": "./dist/server/app-router/index.d.ts" | ||
}, | ||
"./server/pages": { | ||
"browser": "./dist/server/pages/index.mjs", | ||
"import": "./dist/server/pages/index.mjs", | ||
"require": "./dist/server/pages/index.js", | ||
"default": "./dist/server/pages/index.mjs", | ||
"types": "./dist/server/pages/index.d.ts" | ||
}, | ||
"./client": { | ||
"browser": "./dist/client/index.mjs", | ||
"import": "./dist/client/index.mjs", | ||
"require": "./dist/client/index.js", | ||
"default": "./dist/client/index.mjs", | ||
"types": "./dist/client/index.d.ts" | ||
}, | ||
"./package.json": "./package.json" | ||
}, | ||
"./server/app-router": { | ||
"browser": "./dist/server/app-router/index.mjs", | ||
"import": "./dist/server/app-router/index.mjs", | ||
"require": "./dist/server/app-router/index.js", | ||
"default": "./dist/server/app-router/index.mjs", | ||
"types": "./dist/server/app-router/index.d.ts" | ||
"typesVersions": { | ||
"*": { | ||
"server": [ | ||
"./dist/server/index.d.ts" | ||
], | ||
"server/app-router": [ | ||
"./dist/server/app-router/index.d.ts" | ||
], | ||
"server/pages": [ | ||
"./dist/server/pages/index.d.ts" | ||
], | ||
"client": [ | ||
"./dist/client/index.d.ts" | ||
] | ||
} | ||
}, | ||
"./server/pages": { | ||
"browser": "./dist/server/pages/index.mjs", | ||
"import": "./dist/server/pages/index.mjs", | ||
"require": "./dist/server/pages/index.js", | ||
"default": "./dist/server/pages/index.mjs", | ||
"types": "./dist/server/pages/index.d.ts" | ||
"files": [ | ||
"dist" | ||
], | ||
"scripts": { | ||
"build": "tsup", | ||
"dev": "tsup --watch", | ||
"test": "jest" | ||
}, | ||
"./client": { | ||
"browser": "./dist/client/index.mjs", | ||
"import": "./dist/client/index.mjs", | ||
"require": "./dist/client/index.js", | ||
"default": "./dist/client/index.mjs", | ||
"types": "./dist/client/index.d.ts" | ||
"devDependencies": { | ||
"@types/node": "^20.3.1", | ||
"@types/react": "^18.2.0", | ||
"@types/react-dom": "^18.2.0", | ||
"tsup": "^6.7.0", | ||
"typescript": "^5.1.3" | ||
}, | ||
"./package.json": "./package.json" | ||
}, | ||
"typesVersions": { | ||
"*": { | ||
"server": [ | ||
"./dist/server/index.d.ts" | ||
], | ||
"server/app-router": [ | ||
"./dist/server/app-router/index.d.ts" | ||
], | ||
"server/pages": [ | ||
"./dist/server/pages/index.d.ts" | ||
], | ||
"client": [ | ||
"./dist/client/index.d.ts" | ||
] | ||
"peerDependencies": { | ||
"next": "^13.1.0 || ^14.0.0", | ||
"react": "^18.2.0" | ||
}, | ||
"dependencies": { | ||
"@propelauth/node-apis": "^2.1.4", | ||
"jose": "^4.14.4" | ||
} | ||
}, | ||
"files": [ | ||
"dist" | ||
], | ||
"scripts": { | ||
"build": "tsup", | ||
"dev": "tsup --watch", | ||
"test": "jest" | ||
}, | ||
"devDependencies": { | ||
"@types/node": "^20.3.1", | ||
"@types/react": "^18.2.0", | ||
"@types/react-dom": "^18.2.0", | ||
"tsup": "^6.7.0", | ||
"typescript": "^5.1.3" | ||
}, | ||
"peerDependencies": { | ||
"next": "^13.1.0 || ^14.0.0", | ||
"react": "^18.2.0" | ||
}, | ||
"dependencies": { | ||
"@propelauth/node-apis": "^2.1.3", | ||
"jose": "^4.14.4" | ||
} | ||
} |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
411600
4478
Updated@propelauth/node-apis@^2.1.4