...apply 3
All checks were successful
Client Registration / build-deploy (push) Successful in 10s

This commit is contained in:
Grae Jones
2026-03-23 10:25:12 -07:00
parent 8929eda2fa
commit 23fc92bfb6
3 changed files with 12 additions and 9 deletions

File diff suppressed because one or more lines are too long

View File

@@ -13,7 +13,7 @@ import { msalConfig, loginRequest } from './authConfig';
* isSignedIn — true when a user is authenticated
* user — { entraSubjectId, email, displayName, firstName, surname, provider }
* error — string | null
* signIn(hint) — initiates login popup for 'google' | 'apple' | 'microsoft'
* signIn(hint, isNew) — initiates login popup; hint = 'google'|'apple'|'microsoft', isNew=true forces sign-up screen
* signOut() — clears session
* getAccessToken()— returns a fresh ID token for authenticating API calls
* clearError() — clears the error state
@@ -109,13 +109,16 @@ export function AuthProvider({ children }) {
}, []);
// ── Sign in ────────────────────────────────────────────────────────
const signIn = useCallback(async (providerHint) => {
// isNewUser=true → prompt:'create' forces CIAM sign-up screen (Apply path)
// isNewUser=false → standard sign-in screen (Returning path)
const signIn = useCallback(async (providerHint, isNewUser = false) => {
setIsLoading(true);
setError(null);
const hint = PROVIDER_HINTS[providerHint];
const request = {
...loginRequest,
...(isNewUser && { prompt: 'create' }),
...(hint && { extraQueryParameters: { identity_provider_hint: hint } }),
};

View File

@@ -5,11 +5,11 @@ export default function SignInStep() {
const { signIn, isLoading, error } = useAuth();
const [mode, setMode] = useState(null); // null | 'new' | 'returning'
const providers = (
const providers = (isNew) => (
<div className="provider-list">
<button
className="btn-provider btn-provider-google"
onClick={() => signIn('google')}
onClick={() => signIn('google', isNew)}
disabled={isLoading}
>
<span className="provider-icon">G</span>
@@ -18,7 +18,7 @@ export default function SignInStep() {
<button
className="btn-provider btn-provider-apple"
onClick={() => signIn('apple')}
onClick={() => signIn('apple', isNew)}
disabled={isLoading}
>
<span className="provider-icon">🍎</span>
@@ -27,7 +27,7 @@ export default function SignInStep() {
<button
className="btn-provider btn-provider-microsoft"
onClick={() => signIn('microsoft')}
onClick={() => signIn('microsoft', isNew)}
disabled={isLoading}
>
<span className="provider-icon"></span>
@@ -95,7 +95,7 @@ export default function SignInStep() {
{error && <div className="error-message">{error}</div>}
{providers}
{providers(true)}
<p className="step-fine-print">
By continuing, you agree to AdPlatform's Terms of Service and Privacy Policy.
@@ -120,7 +120,7 @@ export default function SignInStep() {
{error && <div className="error-message">{error}</div>}
{providers}
{providers(false)}
<p className="step-fine-print">
Use the same provider you signed up with. If you need help, contact