user2989148
user2989148

Reputation: 33

Firebase Authentication Trigger : How to get the domain name

I am using a Firebase Auth widget on two different domains - abc.com and abc.in . When a new user is created, I am using a trigger to create a db entry. I want to store the domain information to know through which website did the user sign up (abc.com or abc.in).

exports.createAccountDocument = functions.auth.user().onCreate((user,context) => {

// Find whether user signed up on abc.com or abc.in

})

Upvotes: 2

Views: 218

Answers (1)

ultraGentle
ultraGentle

Reputation: 6309

I don't believe the originating URL is built into the onCreate method. See the documentation:

But you could write your own function that passes window.location.href from the front end to get the URL from the browser when your user signs up, and attach that information to the user's database entry.

Upvotes: 4

Related Questions