From 9b770cf95c8338d9d683215223fc7a3e4dd90d75 Mon Sep 17 00:00:00 2001 From: bat Date: Tue, 23 May 2023 06:56:39 +0000 Subject: [PATCH] redirect to correct endpoint --- auth.js | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/auth.js b/auth.js index 3c3bce9..f079563 100644 --- a/auth.js +++ b/auth.js @@ -15,7 +15,7 @@ export class Auth { async redirect(event) { const url = new URL( - this.remoteBaseUrl + '/' + this.giteaAppBaseUrl + '/login/oauth/authorize' ) const search = new URLSearchParams() search.set('response_type', 'code') @@ -24,8 +24,16 @@ export class Auth { 'redirect_uri', this.remoteBaseUrl + '/auth/callback' ) - search.state = 'state' + const timestamp = new Date().valueOf() + // TODO: sign + const signedTimestamp = `${timestamp}` + search.set('state', signedTimestamp) url.search = search.toString() - return Response.redirect(url.toString()) + return new Response('', { + headers: { + Location: url.toString() + }, + status: 302, + }) } } \ No newline at end of file