From efd6d519ce66c1952b28602c645760fc26980ace Mon Sep 17 00:00:00 2001 From: Z User Date: Fri, 27 Mar 2026 23:25:13 +0000 Subject: [PATCH] Fix Auth0 authentication: remove audience parameter for simpler OIDC flow --- js/auth.js | 10 +++++++--- js/config.js | 4 +++- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/js/auth.js b/js/auth.js index f8acf95..26a3ce7 100644 --- a/js/auth.js +++ b/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; } diff --git a/js/config.js b/js/config.js index 2acf999..578e19b 100644 --- a/js/config.js +++ b/js/config.js @@ -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 },