4

I am using the https://github.com/jaredhanson/passport-windowslive NPM package to implement Microsoft account authentication for my NodeJS app. Recently (since 22 April), I have been seeing a few cases in my server logs that show a user trying to login, but the data in the OAuth callback to our server contains an empty array for the emails. This is despite me explicitly specifying the wl.signin,wl.emails scopes. These cases are rare (happens once or twice a day), but frequent enough to make my service monitoring alerts annoying.

This is the user object returned: Note that apart from the user ID, which i hid away for privacy reasons, all the other fields are indeed null or empty as attached in the callback. {"id":"<id hidden>","displayName":null,"name":{"familyName":null,"givenName":null},"emails":[],"photos":[{"value":"https://apis.live.net/v5.0/<id hidden>/picture"}],"provider":"windowslive","_raw":"{\r \"id\": \"<id hidden>\", \r \"name\": null, \r \"first_name\": null, \r \"last_name\": null, \r \"gender\": null, \r \"emails\": {\r \"preferred\": null, \r \"account\": null, \r \"personal\": null, \r \"business\": null\r }, \r \"locale\": null\r}","_json":{"id":"<id hidden>","name":null,"first_name":null,"last_name":null,"gender":null,"emails":{"preferred":null,"account":null,"personal":null,"business":null},"locale":null}}

Did something change in the Windows Live API server recently? Is there a bug somewhere?

Geoffrey Goh
  • 233
  • 1
  • 7

2 Answers2

0

Not sure if you have found a solution to your problem. Anyway, I stumbled upon the same problem.

Apparently, you will get email address only if "First name" and "Last name" are missing. If that info is filled in, email won't be provided. (in my case that was not true, could be that this behavior was changed my MS over time)

But I found out that there is a special scope permission: "wl.contacts_emails"

Scope I'm using now looks like this: "wl.signin,wl.emails,wl.contacts_emails"

When I tried Oauth I got noted that I will provide my email address if I continue. I believe this is the behavior we both are after.

Will confirm if this fix my problem after our logs will be clean for some longer period of time.

If somebody else can reproduce the problem, would be great if he/she could confirm if this is a valid solution before me.

Tom
  • 679
  • 1
  • 12
  • 29
0

I had this issue. Turns out it was a problem with the user account.

I went into my account (OneDrive) and changed my personal email address in the select list (from 'not selected' to my account email address) in the profile. After that the API started returning the correct details.

Seems like an internal bug - should default to the account email if not otherwise set.

onions
  • 132
  • 13
  • you have a select list in one drive? if i want to change something on onedrive i always get redirected to my profile.live.com – i'm still fighting to somehow reproduce the problem in the original question. any hints? – martin s. Sep 11 '17 at 11:31