Fix Auth0 authentication: remove audience parameter for simpler OIDC flow
This commit is contained in:
parent
4e0dd4c107
commit
efd6d519ce
10
js/auth.js
10
js/auth.js
@ -166,12 +166,16 @@ class MoxieAuth {
|
||||
const redirectUri = returnTo || window.location.origin + '/dashboard.html';
|
||||
|
||||
// Build Auth0 authorize URL
|
||||
const authUrl = `https://${CONFIG.auth0.domain}/authorize?` +
|
||||
let authUrl = `https://${CONFIG.auth0.domain}/authorize?` +
|
||||
`response_type=code&` +
|
||||
`client_id=${CONFIG.auth0.clientId}&` +
|
||||
`redirect_uri=${encodeURIComponent(redirectUri)}&` +
|
||||
`scope=openid%20profile%20email&` +
|
||||
`audience=${encodeURIComponent(CONFIG.auth0.audience)}`;
|
||||
`scope=openid%20profile%20email`;
|
||||
|
||||
// Only add audience if it's defined and not empty
|
||||
if (CONFIG.auth0.audience && CONFIG.auth0.audience.trim() !== '') {
|
||||
authUrl += `&audience=${encodeURIComponent(CONFIG.auth0.audience)}`;
|
||||
}
|
||||
|
||||
window.location.href = authUrl;
|
||||
}
|
||||
|
||||
@ -8,7 +8,9 @@ const CONFIG = {
|
||||
auth0: {
|
||||
domain: 'dev-t13zhs74oltgqtfx.us.auth0.com',
|
||||
clientId: 'AWRYU8EBnKaHvRQOMXXADxgGEoBN45oN',
|
||||
audience: 'https://dev-t13zhs74oltgqtfx.us.auth0.com/api/v2/',
|
||||
// Leave audience empty for standard OpenID Connect authentication
|
||||
// Or set to your custom API identifier if you created one in Auth0
|
||||
audience: '',
|
||||
redirectUri: window.location.origin + '/dashboard.html',
|
||||
logoutUri: window.location.origin
|
||||
},
|
||||
|
||||
Loading…
Reference in New Issue
Block a user