Skip to content

Commit

Permalink
Make auth work on next preview
Browse files Browse the repository at this point in the history
  • Loading branch information
henrikhorluck committed Feb 24, 2024
1 parent 70710c0 commit 02cf610
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 10 deletions.
3 changes: 2 additions & 1 deletion .env.localow4
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
OW4_SSO_CLIENT_ID='837461'
OW4_ADDRESS='http://localhost:8000
OW4_ADDRESS='http://localhost:8000'
NEXT_PUBLIC_URL='localhost:8080'
4 changes: 1 addition & 3 deletions next.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -67,11 +67,9 @@ module.exports = withBundleAnalyzer(
return config;
},
env: {
HOSTNAME: process.env.HOSTNAME || "localhost",
PORT: process.env.PORT || "8000",
HOSTNAME: process.env.NEXT_PUBLIC_URL ?? process.env.NEXT_PUBLIC_URL ? `https://${process.env.NEXT_PUBLIC_VERCEL_URL}` : "https://localhost:8080",
OW4_ADDRESS: process.env.OW4_ADDRESS || 'https://old.online.ntnu.no',
AUTH0_CLIENT_ID: process.env.AUTH0_CLIENT_ID || '',
OW4_SSO_CALLBACK: process.env.OW4_SSO_CALLBACK || 'http://localhost:8080/authentication/callback',
OWF_SENTRY_DSN: process.env.OWF_SENTRY_DSN || '',
OWF_GOOGLE_ANALYTICS_KEY: process.env.OWF_GOOGLE_ANALYTICS_KEY || '',
OWF_VAPID_SERVER_KEY: process.env.OWF_VAPID_SERVER_KEY || '',
Expand Down
5 changes: 2 additions & 3 deletions src/authentication/api/settings.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
import { HOST } from 'common/constants/endpoints';
import { UserManagerSettings } from 'oidc-client-ts';

const settings: UserManagerSettings = {
authority: process.env.AUTH0_ISSUER || '',
client_id: process.env.AUTH0_CLIENT_ID || '',
redirect_uri: process.env.OW4_SSO_CALLBACK || '',
post_logout_redirect_uri: HOST,
redirect_uri: `${process.env.HOSTNAME}/authentication/callback`,
post_logout_redirect_uri: `${process.env.HOSTNAME}`,
scope: 'openid profile email',
automaticSilentRenew: true,
filterProtocolClaims: true,
Expand Down
3 changes: 0 additions & 3 deletions src/common/constants/endpoints.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
export const DOMAIN = process.env.OW4_ADDRESS || '';
export const HOST = process.env.NODE_ENV === "production"
? `https://${process.env.HOSTNAME}`
: `http://${process.env.HOSTNAME}:${process.env.PORT}`;

export const AUTH = DOMAIN + '/api/v1/sso/openid/';
export const EVENTS = DOMAIN + '/api/v1/events/';
Expand Down

0 comments on commit 02cf610

Please sign in to comment.