fix redirect
This commit is contained in:
parent
886f06dcd8
commit
3199cfd8dd
|
@ -12,7 +12,7 @@ const userInfoCache = new Map<string, User>()
|
|||
* @description Launch an OAuth2 login request for this request.
|
||||
* @param req Request to launch the login for; required to obtain the Host header.
|
||||
*/
|
||||
export function launchLogin(req: Request) {
|
||||
export function launchLogin(url: string) {
|
||||
// Create a state to be used in the OAuth2 authorization request
|
||||
const state = crypto.randomUUID()
|
||||
|
||||
|
@ -20,7 +20,7 @@ export function launchLogin(req: Request) {
|
|||
const searchParams = new URLSearchParams({
|
||||
response_type: "code",
|
||||
client_id: configuration.oauth2.client.id,
|
||||
redirect_uri: req.url,
|
||||
redirect_uri: url,
|
||||
scope: "openid profile",
|
||||
state
|
||||
})
|
||||
|
@ -41,7 +41,7 @@ export function launchLogin(req: Request) {
|
|||
() => states.delete(state),
|
||||
2*60*1000
|
||||
),
|
||||
redirect_uri: req.url
|
||||
redirect_uri: url
|
||||
}
|
||||
)
|
||||
|
||||
|
|
|
@ -3,13 +3,13 @@ import configuration from "$lib/configuration.js";
|
|||
import { fail } from "@sveltejs/kit";
|
||||
import { avatarDirectory, renderSizes, setNewAvatar } from "$lib/avatars.js";
|
||||
import { join } from "path";
|
||||
export async function load({ request, parent }) {
|
||||
export async function load({ request, parent, url }) {
|
||||
const { user } = await parent();
|
||||
if (!user)
|
||||
launchLogin(request)
|
||||
launchLogin(url.toString())
|
||||
|
||||
return {
|
||||
url: request.url,
|
||||
url: url.toString(),
|
||||
allowedImageTypes: configuration.allowed_types,
|
||||
renderSizes
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue