Skip to content

Commit

Permalink
Merge pull request #107 from MAGICGrants/cloudflare-captcha
Browse files Browse the repository at this point in the history
chore(docker-compose.prod.yml): correctly set NEXT_PUBLIC_TURNSTILE_SITEKEY env variable
  • Loading branch information
Keeqler authored Dec 9, 2024
2 parents b6efd36 + 2ff7130 commit e28af51
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
2 changes: 1 addition & 1 deletion docker-compose.prod.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ services:
NEXTAUTH_SECRET: ${NEXTAUTH_SECRET}
USER_SETTINGS_JWT_SECRET: ${USER_SETTINGS_JWT_SECRET}
TURNSTILE_SECRET: ${TURNSTILE_SECRET}
NEXT_PUBLIC_TURNSTILE_SITEKEY: ${NEXT_PUBLIC_TURNSTILE_SITEKEY}
NEXT_PUBLIC_TURNSTILE_SITEKEY: 0x4AAAAAAA11o5rNvbUuAWSJ

STRAPI_API_URL: ${STRAPI_API_URL}
STRAPI_API_TOKEN: ${STRAPI_API_TOKEN}
Expand Down
5 changes: 4 additions & 1 deletion server/utils/auth.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,15 @@ export async function refreshToken(token: JWT): Promise<JWT> {
)

if (!response.ok) {
console.log(response)
console.log(await response.json())
throw new Error(`Error: ${response.statusText}`)
}

const newToken = await response.json()

const jwtPayload: KeycloakJwtPayload = jwtDecode(newToken.access_token)

console.log(newToken)
return {
sub: jwtPayload.sub,
email: jwtPayload.email,
Expand All @@ -38,6 +40,7 @@ export async function refreshToken(token: JWT): Promise<JWT> {
refreshToken: newToken.refresh_token,
}
} catch (error) {
console.log('not refreshing access token, error', error)
return { ...token, error: 'RefreshAccessTokenError' }
}
}

0 comments on commit e28af51

Please sign in to comment.