diff --git a/pages/api/auth/[...nextauth].ts b/pages/api/auth/[...nextauth].ts index 32e8c6e6afecb3c63e0642ee173539256ac022ba..15458c5bde6759a7efe2bc097130a68ca25319f3 100644 --- a/pages/api/auth/[...nextauth].ts +++ b/pages/api/auth/[...nextauth].ts @@ -7,9 +7,8 @@ const issuer = 'https://keycloak.sso.gwdg.de/auth/realms/academiccloud' async function refreshAccessToken (token: any) { try { - const url = - issuer + '/protocol/openid-connect?' + - new URLSearchParams({ + const url = issuer + '/protocol/openid-connect/token' + const params = new URLSearchParams({ client_id: clientId, client_secret: clientSecret, grant_type: 'refresh_token', @@ -21,6 +20,7 @@ async function refreshAccessToken (token: any) { 'Content-Type': 'application/x-www-form-urlencoded' }, method: 'POST' + body: params }) const refreshedTokens = await response.json()