Redirect users to a page only when they are signing in for the first time

auth0 redirect to original url
auth0 redirect after login
auth0 redirect to login page
jwt redirect after login
auth0 continue endpoint
create user-specific redirect after login
how to create login page that redirects based on user role in html
auth0 redirect after login react

I'm trying to find a way to identify if a user is doing a first time sign in (can't rely solely on registration to determine this) through firebase. Basically, on any type of sign in (Email, phone, facebook, google, etc), I want to check if this is the first time we are adding this user to firebase.

Building off of Michele's answer...

I'd probably throw in there you can use the Firebase Functions to create a document and add it to a collection of profiles (using Firestore or the RTDB) on account creation.

import * as functions from 'firebase-functions';
import * as admin from 'firebase-admin';

export const userOnCreate: functions.CloudFunction<admin.auth.UserInfo> = functions.auth.user()
  .onCreate((event: functions.Event<admin.auth.UserRecord>) => {
    const user: admin.auth.UserRecord =;

    return admin.firestore().collection('profiles').doc(user.uid).set({
      email:, // or username
      firstTimeSignedIn: false

Add the boolean value for firstTimeSignedIn and on sign in query the doc. If it doesn't exist (because the function didn't trigger quick enough), you know that this is there first time. And if the value is false you know it's their first time. After the redirect though, you can set the value with a merge...

firestore.collection('profiles').doc(uid).set({firstTimeSignedIn: true}, { merge: true });

Create User-Specific Redirects After Login, Not only can they be placed directly on the homepage providing a single point of login, helpful to direct first-time users to a special orientation or training page. mostly in the completion form that you want the user to be redirected only once, have values that have to be stored in database, you can check that the value for the user is available in that table or not, if not availbale than that the user have to register the complete details, now from the login page you can redirect him to the complete details form, even you can have a button to let user to enter the details later in his next login or else.

You could add a simple boolean in the User Object:

class/interface User {
    username: string;
    password: string;
    // other properties...
    firstTimeSignedIn: boolean;

if the firstTimeSignedIn is true you can redirect and set it to false.

Redirect Users From Within Rules, Learn how to customize authentication flows by redirecting users using rules. a user, you cannot invoke a second rule to redirect the user at a later time. The user is redirected to an application-specific page with a JWT in the query string. This JWT ensures that only this user's password can be changed and must be  When the user is logged in after completing the registration form they are taken to the homepage. Once the user is logged in (from the registration form) I wish to send them to our services page. But for them to be sent to the homepage every subsequent time they login.

If you want to determine whether a user is new or existing on sign in/up, you should just check the userCredential.additionalUserInfo.isNewUser in userCredential returned in all sign in methods.

Redirect Users After Login Authentication, You can return users to specific pages (URLs) within your application after validating their ID Tokens (authentication). To see an example of how this works, try the  This code checks if a user is logging in for the first time, that is after registration. I want to redirect him to a custom page if so. Otherwise, redirect him to the homepage or admin page. fun

Redirect WordPress Users in Different Situations, If you publish only three short Now imagine yourself coming to the site for the first time while looking for a user to the search results page is quite  This same basic system can also be used to direct users who haven’t logged in for extended periods of time, or who are logging in for the first time after the site has undergone functional changes. Redirect the first time a user logs in. It is sometimes helpful to direct first-time users to a special orientation or training page.

Redirect users on first time login to a particular page, you don't need to change the url in the email, becase user need to click it to visit the page, but You can use the Rules module to do that  Redirect to another page if the user is logged in when pressing again the login button on menu bar. Ask Question. 1. So I have this button on the menu : "My account" that lets the user login on the website and as soon they log in they're redirect to their dashboard.

How to redirect users after login in drupal?, You'll first need to define the URL redirect action at D7 Core - The exact steps to set your site to redirect your visitor 'after a user has logged in' using only Drupal 7 Core which tells me that the page I want to redirect Confirmed in Drupal 7.59 - one-time login is broken if the triggers are set up as  The first option on the settings page allows you to redirect only specific users. You can select a username from the drop-down menu. After that, you can enter the URLs to redirect a user on login and logout. Once done, click on the Add username rule button to store this setting. Repeat the process if you need to set up redirects for more

  • Firebase doesn't allow direct addition of new fields to the defined objects (User). But I might end up doing something similar to your answer in terms of adding it as metadata when I store the user's info to the backend (not the firebase user storage).