Home > @firebase/auth > reauthenticateWithRedirect
reauthenticateWithRedirect() function
Reauthenticates the current user with the specified OAuthProvider using a full-page redirect flow.
Signature:
export declare function reauthenticateWithRedirect(user: User, provider: AuthProvider, resolver?: PopupRedirectResolver): Promise<never>;
Parameters
Parameter | Type | Description |
---|---|---|
user | User | The user. |
provider | AuthProvider | The provider to authenticate. The provider has to be an OAuthProvider. Non-OAuth providers like EmailAuthProvider will throw an error. |
resolver | PopupRedirectResolver | An instance of PopupRedirectResolver, optional if already supplied to initializeAuth() or provided by getAuth(). |
Returns:
Promise<never>
Example
// Sign in using a redirect.
const provider = new FacebookAuthProvider();
const result = await signInWithRedirect(auth, provider);
// This will trigger a full page redirect away from your app
// After returning from the redirect when your app initializes you can obtain the result
const result = await getRedirectResult(auth);
// Link using a redirect.
await linkWithRedirect(result.user, provider);
// This will again trigger a full page redirect away from your app
// After returning from the redirect when your app initializes you can obtain the result
const result = await getRedirectResult(auth);