Azure-Samples / active-directory-node-webapi

A NodeJS web API that is secured using Azure AD and OAuth 2.0 access tokens.
105 stars 64 forks source link

'user is not undefined' #20

Closed KarlGW closed 8 years ago

KarlGW commented 8 years ago

Hello,

I've been trying to implement authentication with AD from a REST API, and I decided to try out passport-azure-ad. I followed the article that this repo belongs to without success. I then downloaded this sample and tried to get it running. I wrote my own way of aquiring a token to test it, but everytime i try to call the protected routes I get a response like: {"code":"InternalError","message":"user is not defined"}

I've tried to look over most things based on node and passport, and I can't seem to find anything that adresses this. I've tried to debug with console.log, but nothing indicates what's going wrong.

Best regards,

KarlGW commented 8 years ago

Seem the placement of some of the results in the BearerStrategy was misplaced in the example code as well. Got it working after switching placement and defining user when user lookup had failed.