Auth0 Home Blog Docs

Multiple welcome emails being sent

emails
email
welcome-email

#1

I am using the Gmail social connection for login and setup a welcome email which is sent via SMTP (Gmail) email provider. However, for some users, they are receiving two to three welcome emails in a short time (within 2-3 minutes) after they login for the first time. Is this a bug or am I doing something wrong?

EDIT:
Seems like from the past few days, a welcome email is being sent to users every time they login.

Here are the logs of a user who has been sent 3 welcome emails - 1 email at each of the 3 timings mentioned in the logs (All 3 are recorded as a Success Login event). client_id, ip, user_id, user_name values are hidden to protect privacy but the values are the same in all 3 logs

{
  "date": "2017-12-20T01:46:26.644Z",
  "type": "s",
  "connection": "google-oauth2",
  "connection_id": "con_c94TX4W5q5kStnnY",
  "client_id": "<HIDDEN>",
  "client_name": "Birthday Tracker",
  "ip": "<HIDDEN>",
  "user_agent": "Mozilla/5.0 (iPad; CPU OS 9_3_5 like Mac OS X) AppleWebKit/601.1.46 (KHTML, like Gecko) Version/9.0 Mobile/13G36 Safari/601.1",
  "details": {
    "prompts": 
      {
        "name": "oauth2-authenticate",
        "initiatedAt": 1513734360301,
        "completedAt": 1513734386331,
        "timers": {
          "rules": 297
        },
        "connection": "google-oauth2",
        "elapsedTime": 26030
      }
    ],
    "initiatedAt": 1513734044354,
    "completedAt": 1513734386641,
    "elapsedTime": 342287,
    "stats": {}
  },
  "user_id": "<HIDDEN>",
  "user_name": "<HIDDEN>",
  "strategy": "google-oauth2",
  "strategy_type": "social",
  "auth0_client": {
    "name": "lock.js",
    "version": "10.18.0",
    "lib_version": "8.7.0"
  },
  "log_id": "49579568688084788852716023226483068531291786803790479362"
}

Log 2

{
  "date": "2017-12-20T01:32:58.534Z",
  "type": "s",
  "connection": "google-oauth2",
  "connection_id": "con_c94TX4W5q5kStnnY",
  "client_id": "<HIDDEN>",
  "client_name": "Birthday Tracker",
  "ip": "<HIDDEN>",
  "user_agent": "Mozilla/5.0 (iPhone; CPU iPhone OS 11_2_1 like Mac OS X) AppleWebKit/604.4.7 (KHTML, like Gecko) Version/11.0 Mobile/15C153 Safari/604.1",
  "details": {
    "prompts": 
      {
        "name": "oauth2-authenticate",
        "initiatedAt": 1513733456119,
        "completedAt": 1513733578213,
        "timers": {
          "rules": 302
        },
        "connection": "google-oauth2",
        "elapsedTime": 122094
      }
    ],
    "initiatedAt": 1513733450358,
    "completedAt": 1513733578530,
    "elapsedTime": 128172,
    "stats": {}
  },
  "user_id": "<HIDDEN>",
  "user_name": "<HIDDEN>",
  "strategy": "google-oauth2",
  "strategy_type": "social",
  "auth0_client": {
    "name": "lock.js",
    "version": "10.18.0",
    "lib_version": "8.7.0"
  },
  "log_id": "49579568688084788852716023168521120109868335428446191618"
}

Log 3

{
  "date": "2017-12-20T01:42:58.247Z",
  "type": "s",
  "connection": "google-oauth2",
  "connection_id": "con_c94TX4W5q5kStnnY",
  "client_id": "<HIDDEN>",
  "client_name": "Birthday Tracker",
  "ip": "<HIDDEN>",
  "user_agent": "Mozilla/5.0 (iPhone; CPU iPhone OS 11_2_1 like Mac OS X) AppleWebKit/604.4.7 (KHTML, like Gecko) Version/11.0 Mobile/15C153 Safari/604.1",
  "details": {
    "prompts": 
      {
        "name": "oauth2-authenticate",
        "initiatedAt": 1513734144286,
        "completedAt": 1513734177943,
        "timers": {
          "rules": 286
        },
        "connection": "google-oauth2",
        "elapsedTime": 33657
      }
    ],
    "initiatedAt": 1513734101145,
    "completedAt": 1513734178244,
    "elapsedTime": 77099,
    "stats": {}
  },
  "user_id": "<HIDDEN>",
  "user_name": "<HIDDEN>",
  "strategy": "google-oauth2",
  "strategy_type": "social",
  "auth0_client": {
    "name": "lock.js",
    "version": "10.18.0",
    "lib_version": "8.7.0"
  },
  "log_id": "49579568688084788852716023212244340227870670021730500610"
}

#2

UPDATE:

The logs you provided allowed me to trace the end-user in question and I found out that the user did not have login count information in the user profile. There may be other users in the same situation so this could explain why they receive welcome emails at each login. I could not reproduce this in my test tenants so the situation might be specific only to certain accounts or dependent of configuration, however, I reported this internally for further analysis and will update my answer again when I have additional information.

Meanwhile, you may want to consider disabling the welcome email template entirely given that if my theory is right those users would continue to receive welcome emails in future logins due to the missing login count information.


There is no bug that I’m aware related to multiple welcome emails; in relation to doing something specific that is causing that behavior it’s hard to tell with limited information. You should review the logs to see if there’s anything suspicious happening for those users and also update your question with the log entries in questions.


#3

I went through the logs and I did not find anything strange. I have several instances where users have been sent multiple welcome emails and I am being threatened that my email ID will be reported as spam. There must be something wrong on Auth0’s side.


#4

I have updated the question with the logs.


#5

@jmangelo Have you had the time to look into this?


#6

@abhilash1in I reviewed the situation again now with more context information (thanks for sharing the logs) and found an edge case that might explain this; I will update my answer.


#7

@jmangelo Sure, thank you for looking into this! Please let me know if you need any more information. In fact, you can checkout the problem yourself. Try logging in multiple times at https://birthdaytracker.goflo.in/login using your Google account. You will get a welcome email every time.


#8

@jmangelo Thank you for the updated answer. I would like to point out that I am able to see the correct logins_count field from the user profile of the users who have received multiple welcome emails. It is incremented correctly after every login. (edit: that field exists only for some users, weird! ) Another thing I would like you to know is that, this problem of welcome email at each login is happening only to newer users. My older account is not receiving welcome emails with every login.


#9

@jmangelo there’s something weird going on. The same user is being shown twice, once with login count of 0 and other with login count of 4. However, clicking on both of them lead to the same user page (the user with Latest Login : 2 months ago)

Here’s the screenshot:

![alt text][1]


#10

Also, the count of LOGINS and NEW SIGNUPS on the dashboard is being shown as ZERO. PFA

![alt text][1]


#11

Based on the information I have the logins_count situation should already have been addressed and any new login will mean that the property will be added to the user profile. Have in mind that this may mean that some existing users may still get treated as first-time users for the next login where the count is started.


#12

The duplicate user situation may be a completely different situation; if that’s a test user where data loss is not an issue I would personally risk deleting it to see what would happen, but I will leave that decision to you. However, if the situation persists you raise that as separate question.

Also have in mind that the dashboard stats interface may still not be completely updated even though login count is now being correctly counted on individual users.


#13

Thanks! The “multiple welcome emails” issue also seems to have been fixed as a consequence!


#14