angular-connect-rest-sample icon indicating copy to clipboard operation
angular-connect-rest-sample copied to clipboard

getting a 401 Unauthorized on https://graph.microsoft.com/v1.0/me

Open kcferguson1 opened this issue 9 years ago • 4 comments

angular.js:10514 GET https://graph.microsoft.com/v1.0/me 401 (Unauthorized)

kcferguson1 avatar Jan 12 '17 19:01 kcferguson1

Hi @kcferguson1 . Thanks for reporting this issue. I did a fresh download, install, and app registration, but the sample works for me with personal and work accounts.

Are you being prompted to consent for Sign you in and read your profile and Send mail as you?

DianeD avatar Jan 12 '17 19:01 DianeD

i got that on the first try and consented, the i get the error.

kcferguson1 avatar Jan 13 '17 04:01 kcferguson1

Are you getting any additional error info in the response body? You can check on the Network tab of the browser developer tools, or in Fiddler. For example, here's the error I got after I removed the User.Read permission from the sample:

image

If not, can you please try these troubleshooting steps? Using the same account , log into Graph explorer and see if the https://graph.microsoft.com/v1.0/me request works there. If it doesn't, can you provide the full Response body?

Capture the access token, paste it in http://jwt.io, and check that the "scp" parameter grants "Mail.Send User.Read" access. To capture the token, you can use Fiddler, the Network tab in the browser dev tools, or put a breakpoint in aad.js on line 33.

Provide the request id and date of the failing request? You can get it in from dev tools or Fiddler.

image

DianeD avatar Jan 13 '17 18:01 DianeD

Hi @kcferguson1 . Closing this issue, but please reopen it if you're still having problems.

DianeD avatar Jan 25 '17 17:01 DianeD