@@ -2,7 +2,7 @@ import { type TokenSet } from "@auth/core/types";
22import NextAuth , { type Session as DefaultSession , type User } from "next-auth" ;
33import KeycloakProvider from "next-auth/providers/keycloak" ;
44
5- import { OIDC_CLIENT_ID , OIDC_SERVER_URL , OIDC_SERVER_URL_INTERNAL } from "../config/keycloak" ;
5+ import { NEXT_PUBLIC_OIDC_CLIENT_ID , NEXT_PUBLIC_OIDC_SERVER_URL , NEXT_PUBLIC_OIDC_SERVER_URL_INTERNAL } from "../config/keycloak" ;
66
77export interface Session extends DefaultSession {
88 error ?: "RefreshAccessTokenError"
@@ -45,10 +45,10 @@ export const { handlers: { GET, POST }, auth } = NextAuth({
4545 } else {
4646 // If the access token has expired, try to refresh it
4747 try {
48- const response = await fetch ( `${ OIDC_SERVER_URL_INTERNAL } /protocol/openid-connect/token` , {
48+ const response = await fetch ( `${ NEXT_PUBLIC_OIDC_SERVER_URL_INTERNAL } /protocol/openid-connect/token` , {
4949 headers : { "Content-Type" : "application/x-www-form-urlencoded" } ,
5050 body : new URLSearchParams ( {
51- client_id : OIDC_CLIENT_ID ,
51+ client_id : NEXT_PUBLIC_OIDC_CLIENT_ID ,
5252 grant_type : "refresh_token" ,
5353 refresh_token : token . refreshToken ,
5454 } ) ,
@@ -96,8 +96,8 @@ export const { handlers: { GET, POST }, auth } = NextAuth({
9696 providers : [
9797 KeycloakProvider ( {
9898 id : 'keycloak' ,
99- clientId : OIDC_CLIENT_ID ,
100- issuer : OIDC_SERVER_URL ,
99+ clientId : NEXT_PUBLIC_OIDC_CLIENT_ID ,
100+ issuer : NEXT_PUBLIC_OIDC_SERVER_URL ,
101101
102102 // user information will be extracted from the `id_token` claims, instead of making a request to the `userinfo` endpoint
103103 // https://next-auth.js.org/configuration/providers/oauth
@@ -113,10 +113,10 @@ export const { handlers: { GET, POST }, auth } = NextAuth({
113113 // would love to use discovery, but can't because since next-auth:v5 token endpoint is called internally
114114 // also, discovery doesn't seem to work properly: https://github.com/nextauthjs/next-auth/pull/9718
115115 // wellKnown: `${OIDC_SERVER_URL}/.well-known/openid-configuration`,
116- token : `${ OIDC_SERVER_URL_INTERNAL } /protocol/openid-connect/token` ,
117- userinfo : `${ OIDC_SERVER_URL } /protocol/openid-connect/token` ,
116+ token : `${ NEXT_PUBLIC_OIDC_SERVER_URL_INTERNAL } /protocol/openid-connect/token` ,
117+ userinfo : `${ NEXT_PUBLIC_OIDC_SERVER_URL } /protocol/openid-connect/token` ,
118118 authorization : {
119- url : `${ OIDC_SERVER_URL } /protocol/openid-connect/auth` ,
119+ url : `${ NEXT_PUBLIC_OIDC_SERVER_URL } /protocol/openid-connect/auth` ,
120120 // https://authjs.dev/guides/basics/refresh-token-rotation#jwt-strategy
121121 params : {
122122 access_type : "offline" ,
0 commit comments