Skip to content

Commit

Permalink
Merge pull request #185 from kinde-oss/peter/2.2.4-hotfix
Browse files Browse the repository at this point in the history
fix: env variables
  • Loading branch information
peterphanouvong authored Jun 26, 2024
2 parents 48a6456 + 85590a6 commit 17267f8
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 9 deletions.
6 changes: 3 additions & 3 deletions src/handlers/auth.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,13 +36,13 @@ const getRoute = (endpoint) => {
/**
* @param {object} [request]
* @param {string} [endpoint]
* @param {{onError?: () => void; config: {audience?: string | string[], clientId?: string, clientSecret?: string, issuerURL?: string, siteUrl?: string, postLoginRedirectUrl?: string, postLogoutRedirectUrl?: string}}} options
* @param {{onError?: () => void; config: {audience?: string | string[], clientId?: string, clientSecret?: string, issuerURL?: string, siteUrl?: string, postLoginRedirectUrl?: string, postLogoutRedirectUrl?: string}}} [options]
* @returns {(req, res) => any}
*/
export default (request, endpoint, options) => {
if (!config.clientOptions.authDomain && !options?.config?.issuerURL)
if (!config.clientOptions.authDomain)
throw new Error(
"env variable 'KINDE_ISSUER_URL' is not set and not passed in options"
"The environment variable 'KINDE_ISSUER_URL' is required. Set it in your .env file"
);

if (!config.clientOptions.clientId && !options?.config?.clientId)
Expand Down
6 changes: 3 additions & 3 deletions src/routerClients/AppRouterClient.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,9 @@ export default class AppRouterClient extends RouterClient {
logoutRedirectURL:
options?.config?.postLogoutRedirectUrl ||
config.clientOptions.logoutRedirectURL,
redirectURL:
`${options?.config?.siteUrl}/api/auth/kinde_callback` ||
config.clientOptions.redirectURL,
redirectURL: options?.config?.siteUrl
? `${options?.config?.siteUrl}/api/auth/kinde_callback`
: config.clientOptions.redirectURL,
siteUrl: config.redirectURL || options.config.siteUrl
};
this.kindeClient = createKindeServerClient(
Expand Down
6 changes: 3 additions & 3 deletions src/routerClients/PagesRouterClient.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,9 @@ export default class PagesRouterClient extends RouterClient {
logoutRedirectURL:
options?.config?.postLogoutRedirectUrl ||
config.clientOptions.logoutRedirectURL,
redirectURL:
`${options?.config?.siteUrl}/api/auth/kinde_callback` ||
config.clientOptions.redirectURL,
redirectURL: options?.config?.siteUrl
? `${options?.config?.siteUrl}/api/auth/kinde_callback`
: config.clientOptions.redirectURL,
siteUrl: config.redirectURL || options.config.siteUrl
};
this.kindeClient = createKindeServerClient(
Expand Down

0 comments on commit 17267f8

Please sign in to comment.