How to Send Email Invitations for Application Signup for Social accounts such as gmail email?

How to Send Email Invitations for Application Signup for Social accounts such as gmail email? I can do it when a user is in the Auth0 database but the requirement is that Send Email Invitations for Application Signup to existing google accounts.

Hi @dev40 ,

Welcome to the Auth0 Community!

The “Send Email Invitation for Application Signup” is for the Auth0 database. The invitation basically is a change password link. For Social accounts, the social channel is the IdP, so we can not update password. Could you please share some context regarding why you only want to send email invitation for application signup for Google accounts?

One possible solution for your use case is to set up Account Linking, where users link their Auth0 database accounts with their Google Account. This article explains how to use the Auth0 Account linking extension, and this article explains how to implement client-side Account linking.

Hope this helps!

1 Like

Hi @lihua.zhang ,

For now we will only allow google emails but later we will allow any social accounts like facebook accounts for registration and login. We have an app that the users can login using their account registered in Auth0. We will not be using the Auth0 database because we want to utilize the social feature. The use case is that we will send users an invitation link then from that they will be registered in Auth0 having connection like google-oauth2.

We also preferred not to make the user change password because they might be annoyed. We just want them to be invited and registered in Auth0.

Any further recommendation from this?

Hi @dev40

First, be aware that you cannot do “invite only” with social. Any social user can sign up for your app, whether they receive an invitation or not.

Social users are “created” in Auth0 by logging in. So you can just send the users a link that redirects them to the login page. Then they will log in with their social credentials, be redirected back to the app and have an account.

The “login page” should be in your app and use javascript to automatically kick off the login process.

John

3 Likes

@john.gateley This is basically my solution right now. Thank you.

@lihua.zhang @john.gateley we change our process flow and we are implementing linking between account in Auth0 DB and google. We try to login using google account then perform linking. But after this the Authorization token generated by /oauth/token became invalid. We cannot even refresh it. Even the Code retrieved to be used to get authorization token became invalid. We want to access our APP immediately after registration and linking without prompting the user to login again after linking. Can we do this or the user really needs to login again?

Can we get Authorization token without user action?

any updates for this concern @lihua.zhang @john.gateley ?

@dev40 I’ll link to a previous comment I made regarding a question for Account Linking in Auth0 and uninterrupted sessions

If you are setting the Auth0 DB account as the primary account when performing linking, you must also set and return the Auth0 DB account as the user in the Auth0 Rule or Action.

If you are using Auth0 Rules, you can do this with the following

user = primaryUser; 
context.primaryUser = primaryUser.user_id;
return callback(null, user, context);

If you are using Auth0 Actions, you can do this with the following

event.user = primaryUser;
return {
  user: primaryUser
}

I hope this helps!

@gparascandolo where do I get primaryUser and how do I know what type of object and what properties of the primaryUser?

After setting it, why do I need to return the primary user? I am setting the account in Auth0 DB as the primary

@dev40 Sorry, maybe I misunderstood your previous comment. You said you implemented linking between the Auth0 DB and Google account, correct? How are you doing this now?

Are you using the Auth0 Account linking extension mentioned above or a client-side method? Or are you doing it server-side with the Auth0 Management API to account link?

@gparascandolo I am using Auth0 Management API to account link.

Is it also ok if I just set the primary account to the newly registered social account? It seems to fix my issue.

@dev40 Yes, you can set the primary account to the newly registered social account.

Be aware that if you do this, you will lose the original user_metadata and app_metadata properties of the Auth0 DB account. Make sure to copy or merge important metadata to the newly registered social account before Account Linking.

Please see the notes in this section of the documents for other things to consider too
(for example, the secondary profile is removed from the user list too):
https://auth0.com/docs/manage-users/user-accounts/user-account-linking#how-it-works

Also be aware that if you need to update email, email_verified, phone_number, phone_verified, username or password of the secondary Auth0 DB account in the future via the PATCH /api/v2/users/{id} endpoint, you need to also specify the connection in the API requests.

@gparascandolo noted , I believe that most users will use their social accounts to login.