firebase / firebase-admin-go

Firebase Admin Go SDK
Apache License 2.0
1.14k stars 247 forks source link

How to verify users emails? #487

Closed marawan-nwh closed 2 years ago

marawan-nwh commented 2 years ago

Hi,

I want to build a custom endpoint to verify users emails, but I can't find any function that could do that in the auth package.

Something like auth.applyActionCode here.

Am I missing something?

google-oss-bot commented 2 years ago

I found a few problems with this issue:

lahirumaramba commented 2 years ago

Did you want to send a verification email to a user? If that's your requirement, you can generate a email verification link using the Admin SDK. See: "Generate email verification link".

marawan-nwh commented 2 years ago

@lahirumaramba Thanks for your help. No, I am already generating the email, but it links to a firebase endpoint, that verifies the email and gives you a success message. We want to build a custom page.

lahirumaramba commented 2 years ago

I see. I am not sure if that is currently supported in the REST API.

@prameshj Do you know if this is something we currently support in GCIP?

prameshj commented 2 years ago

@marwan-nwh can you elaborate on your usecase - why is a custom page preferable here?

marawan-nwh commented 2 years ago

@prameshj We want to control where to redirect the users, the messages that show up, and we want to control the design of the page too. Actually, we want to do that with all the actions like verifyEmail and resetPassword.

prameshj commented 2 years ago

cc @renkelvin

prameshj commented 2 years ago

the current SDK code invokes ‘/v1/accounts:sendOobCode’ API to firebase in reset password/verifyEmail flow and the firebase hosted UI ensures that the '/v1/accounts:signInWithEmailLink' is invoked.

In this issue, the ask is to send this request to a custom endpoint. This is not supported currently and I think is out of scope for the firebase SDKs.

We want to control where to redirect the users, the messages that show up, and we want to control the design of the page too. redirecting users can be done by setting the continue_uri as described in https://firebase.google.com/docs/auth/web/passing-state-in-email-actions#passing_statecontinue_url_in_email_actions

marawan-nwh commented 2 years ago

@prameshj I will try to use the API directly, or use the JS SDK. Thanks for your help.

For anyone searching in the future: https://firebase.google.com/docs/auth/custom-email-handler#create_the_email_action_handler_page https://firebase.google.com/docs/reference/js/v8/firebase.auth.Auth#applyactioncode https://cloud.google.com/identity-platform/docs/reference/rest/v1/accounts/signInWithEmailLink