This commit is contained in:
2
Client-Registration/dist/bundle.js
vendored
2
Client-Registration/dist/bundle.js
vendored
File diff suppressed because one or more lines are too long
@@ -13,7 +13,7 @@ import { msalConfig, loginRequest } from './authConfig';
|
|||||||
* isSignedIn — true when a user is authenticated
|
* isSignedIn — true when a user is authenticated
|
||||||
* user — { entraSubjectId, email, displayName, firstName, surname, provider }
|
* user — { entraSubjectId, email, displayName, firstName, surname, provider }
|
||||||
* error — string | null
|
* 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
|
* signOut() — clears session
|
||||||
* getAccessToken()— returns a fresh ID token for authenticating API calls
|
* getAccessToken()— returns a fresh ID token for authenticating API calls
|
||||||
* clearError() — clears the error state
|
* clearError() — clears the error state
|
||||||
@@ -109,13 +109,16 @@ export function AuthProvider({ children }) {
|
|||||||
}, []);
|
}, []);
|
||||||
|
|
||||||
// ── Sign in ────────────────────────────────────────────────────────
|
// ── 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);
|
setIsLoading(true);
|
||||||
setError(null);
|
setError(null);
|
||||||
|
|
||||||
const hint = PROVIDER_HINTS[providerHint];
|
const hint = PROVIDER_HINTS[providerHint];
|
||||||
const request = {
|
const request = {
|
||||||
...loginRequest,
|
...loginRequest,
|
||||||
|
...(isNewUser && { prompt: 'create' }),
|
||||||
...(hint && { extraQueryParameters: { identity_provider_hint: hint } }),
|
...(hint && { extraQueryParameters: { identity_provider_hint: hint } }),
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -5,11 +5,11 @@ export default function SignInStep() {
|
|||||||
const { signIn, isLoading, error } = useAuth();
|
const { signIn, isLoading, error } = useAuth();
|
||||||
const [mode, setMode] = useState(null); // null | 'new' | 'returning'
|
const [mode, setMode] = useState(null); // null | 'new' | 'returning'
|
||||||
|
|
||||||
const providers = (
|
const providers = (isNew) => (
|
||||||
<div className="provider-list">
|
<div className="provider-list">
|
||||||
<button
|
<button
|
||||||
className="btn-provider btn-provider-google"
|
className="btn-provider btn-provider-google"
|
||||||
onClick={() => signIn('google')}
|
onClick={() => signIn('google', isNew)}
|
||||||
disabled={isLoading}
|
disabled={isLoading}
|
||||||
>
|
>
|
||||||
<span className="provider-icon">G</span>
|
<span className="provider-icon">G</span>
|
||||||
@@ -18,7 +18,7 @@ export default function SignInStep() {
|
|||||||
|
|
||||||
<button
|
<button
|
||||||
className="btn-provider btn-provider-apple"
|
className="btn-provider btn-provider-apple"
|
||||||
onClick={() => signIn('apple')}
|
onClick={() => signIn('apple', isNew)}
|
||||||
disabled={isLoading}
|
disabled={isLoading}
|
||||||
>
|
>
|
||||||
<span className="provider-icon">🍎</span>
|
<span className="provider-icon">🍎</span>
|
||||||
@@ -27,7 +27,7 @@ export default function SignInStep() {
|
|||||||
|
|
||||||
<button
|
<button
|
||||||
className="btn-provider btn-provider-microsoft"
|
className="btn-provider btn-provider-microsoft"
|
||||||
onClick={() => signIn('microsoft')}
|
onClick={() => signIn('microsoft', isNew)}
|
||||||
disabled={isLoading}
|
disabled={isLoading}
|
||||||
>
|
>
|
||||||
<span className="provider-icon">⊞</span>
|
<span className="provider-icon">⊞</span>
|
||||||
@@ -95,7 +95,7 @@ export default function SignInStep() {
|
|||||||
|
|
||||||
{error && <div className="error-message">{error}</div>}
|
{error && <div className="error-message">{error}</div>}
|
||||||
|
|
||||||
{providers}
|
{providers(true)}
|
||||||
|
|
||||||
<p className="step-fine-print">
|
<p className="step-fine-print">
|
||||||
By continuing, you agree to AdPlatform's Terms of Service and Privacy Policy.
|
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>}
|
{error && <div className="error-message">{error}</div>}
|
||||||
|
|
||||||
{providers}
|
{providers(false)}
|
||||||
|
|
||||||
<p className="step-fine-print">
|
<p className="step-fine-print">
|
||||||
Use the same provider you signed up with. If you need help, contact
|
Use the same provider you signed up with. If you need help, contact
|
||||||
|
|||||||
Reference in New Issue
Block a user