diff --git a/packages/zudoku/src/lib/authentication/components/CallbackHandler.tsx b/packages/zudoku/src/lib/authentication/components/CallbackHandler.tsx index 4435e841..11871334 100644 --- a/packages/zudoku/src/lib/authentication/components/CallbackHandler.tsx +++ b/packages/zudoku/src/lib/authentication/components/CallbackHandler.tsx @@ -3,6 +3,7 @@ import { useEffect, useRef, useState } from "react"; import { useNavigate } from "react-router-dom"; import { DeveloperHint } from "../../components/DeveloperHint.js"; import { ErrorPage } from "../../components/ErrorPage.js"; +import { Spinner } from "../../components/Spinner.js"; import { SyntaxHighlight } from "../../components/SyntaxHighlight.js"; export function CallbackHandler({ @@ -50,5 +51,9 @@ export function CallbackHandler({ ); } - return <p>Loading...</p>; + return ( + <div className="grid h-full place-items-center"> + <Spinner /> + </div> + ); } diff --git a/packages/zudoku/src/lib/authentication/providers/auth0.tsx b/packages/zudoku/src/lib/authentication/providers/auth0.tsx index 47dda774..cd6bd82d 100644 --- a/packages/zudoku/src/lib/authentication/providers/auth0.tsx +++ b/packages/zudoku/src/lib/authentication/providers/auth0.tsx @@ -1,9 +1,24 @@ -import { Auth0AuthenticationConfig } from "../../../config/config.js"; +import { + Auth0AuthenticationConfig, + OpenIDAuthenticationConfig, +} from "../../../config/config.js"; import { AuthenticationProviderInitializer } from "../authentication.js"; import { useAuthState } from "../state.js"; import { OpenIDAuthenticationProvider } from "./openid.js"; class Auth0AuthenticationProvider extends OpenIDAuthenticationProvider { + constructor(config: OpenIDAuthenticationConfig) { + super(config); + + // Prefill the authorization server since we know what Auth0's config is + this.authorizationServer = { + issuer: config.issuer, + authorization_endpoint: `${config.issuer}/authorize`, + token_endpoint: `${config.issuer}/oauth/token`, + code_challenge_methods_supported: ["S256", "plain"], + }; + } + onAuthorizationUrl = async ( url: URL, { isSignUp }: { isSignUp: boolean }, @@ -12,6 +27,17 @@ class Auth0AuthenticationProvider extends OpenIDAuthenticationProvider { url.searchParams.set("screen_hint", "signup"); } }; + + override async getAuthServer() { + this.authorizationServer = { + issuer: new URL(this.authorizationEndpoint!).origin, + authorization_endpoint: this.authorizationEndpoint, + token_endpoint: this.tokenEndpoint, + code_challenge_methods_supported: [], + }; + return this.authorizationServer; + } + signOut = async (): Promise<void> => { useAuthState.setState({ isAuthenticated: false,