Skip to content

Commit e131fb6

Browse files
committed
fix(server): m2m auth0 issuer base url
Signed-off-by: Asitha de Silva <asithade@gmail.com>
1 parent 4acdc61 commit e131fb6

File tree

4 files changed

+10
-10
lines changed

4 files changed

+10
-10
lines changed

apps/lfx-pcc/.env.example

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ PCC_AUTH0_SECRET=sufficiently-long-string
1414
# M2M Token Generation
1515
M2M_AUTH_CLIENT_ID=your-auth0-client-id
1616
M2M_AUTH_CLIENT_SECRET=your-auth0-client-secret
17-
M2M_AUTH_ISSUER_BASE_URL=https://auth.k8s.orb.local
17+
M2M_AUTH_ISSUER_BASE_URL=https://auth.k8s.orb.local/
1818
M2M_AUTH_AUDIENCE=http://lfx-api.k8s.orb.local/
1919

2020
# Microservice Configuration

apps/lfx-pcc/src/server/utils/m2m-token.util.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ export async function generateM2MToken(req: Request): Promise<string> {
2929

3030
// Select the appropriate request configuration
3131
const config = isAuthelia ? AUTHELIA_TOKEN_REQUEST : AUTH0_TOKEN_REQUEST;
32-
const tokenEndpoint = `${issuerBaseUrl}${config.endpoint}`;
32+
const tokenEndpoint = `${issuerBaseUrl}/${config.endpoint}`;
3333

3434
// Prepare request options based on auth provider
3535
const requestOptions = {
@@ -113,8 +113,8 @@ export async function generateM2MToken(req: Request): Promise<string> {
113113
* Request configuration for Auth0 M2M token generation
114114
*/
115115
const AUTH0_TOKEN_REQUEST = {
116-
endpoint: '/oauth/token',
117-
method: 'POST' as const,
116+
endpoint: 'oauth/token',
117+
method: 'POST',
118118
createHeaders: () => ({
119119
['Cache-Control']: 'no-cache',
120120
['Content-Type']: 'application/json',
@@ -132,8 +132,8 @@ const AUTH0_TOKEN_REQUEST = {
132132
* Request configuration for Authelia M2M token generation
133133
*/
134134
const AUTHELIA_TOKEN_REQUEST = {
135-
endpoint: '/api/oidc/token',
136-
method: 'POST' as const,
135+
endpoint: 'api/oidc/token',
136+
method: 'POST',
137137
createHeaders: () => {
138138
const clientId = process.env['M2M_AUTH_CLIENT_ID'];
139139
const clientSecret = process.env['M2M_AUTH_CLIENT_SECRET'];

docs/architecture/backend/authentication.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,15 +12,15 @@ The application uses Auth0 for user authentication via `express-openid-connect`
1212
# User Authentication (Auth0/Authelia)
1313
PCC_AUTH0_SECRET='your-auth0-secret'
1414
PCC_BASE_URL='http://localhost:4000'
15-
PCC_AUTH0_ISSUER_BASE_URL='https://your-domain.auth0.com'
15+
PCC_AUTH0_ISSUER_BASE_URL='https://your-domain.auth0.com/'
1616
PCC_AUTH0_CLIENT_ID='your-client-id'
1717
PCC_AUTH0_CLIENT_SECRET='your-client-secret'
1818
PCC_AUTH0_AUDIENCE='https://your-api-audience'
1919

2020
# Machine-to-Machine (M2M) Token Authentication
2121
M2M_AUTH_CLIENT_ID='your-m2m-client-id'
2222
M2M_AUTH_CLIENT_SECRET='your-m2m-client-secret'
23-
M2M_AUTH_ISSUER_BASE_URL='https://auth.k8s.orb.local'
23+
M2M_AUTH_ISSUER_BASE_URL='https://auth.k8s.orb.local/'
2424
M2M_AUTH_AUDIENCE='http://lfx-api.k8s.orb.local/'
2525
```
2626

docs/deployment.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -208,15 +208,15 @@ LOG_LEVEL=info
208208
# Get these values from your Auth0 dashboard
209209
PCC_AUTH0_CLIENT_ID=your-auth0-client-id
210210
PCC_AUTH0_CLIENT_SECRET=your-auth0-client-secret
211-
PCC_AUTH0_ISSUER_BASE_URL=https://auth.k8s.orb.local
211+
PCC_AUTH0_ISSUER_BASE_URL=https://auth.k8s.orb.local/
212212
PCC_AUTH0_AUDIENCE=http://lfx-api.k8s.orb.local/
213213
PCC_AUTH0_SECRET=sufficiently-long-string
214214

215215
# Machine-to-Machine (M2M) Authentication
216216
# For server-side API calls from public endpoints
217217
M2M_AUTH_CLIENT_ID=your-m2m-client-id
218218
M2M_AUTH_CLIENT_SECRET=your-m2m-client-secret
219-
M2M_AUTH_ISSUER_BASE_URL=https://auth.k8s.orb.local
219+
M2M_AUTH_ISSUER_BASE_URL=https://auth.k8s.orb.local/
220220
M2M_AUTH_AUDIENCE=http://lfx-api.k8s.orb.local/
221221

222222
# Microservice Configuration

0 commit comments

Comments
 (0)