Skip to content

Profile info of user empty #73

Open
@codeeverystory

Description

@codeeverystory

I am connecting my node app to Microsoft Outlook using passport-oauth2 where I am experiencing some major error where it asks for permissions from the user and take me to redirectURL but it is not able to get me the profile info of user and return an empty object of profile.Below is some of my code i used:

passport.js

const OutlookStrategy=require('passport-oauth2').Strategy;
passport.use(new OutlookStrategy({

authorizationURL: 'https://login.microsoftonline.com/common/oauth2/v2.0/authorize',
tokenURL: 'https://login.microsoftonline.com/common/oauth2/v2.0/token',
clientID: configAuth.outlookAuth.clientID,
clientSecret: configAuth.outlookAuth.clientSecret,
callbackURL: configAuth.outlookAuth.redirectURL
},
function(accessToken, refreshToken, profile, cb) {
console.log(accessToken);
console.log(profile); <-------------- This is empty object-------------------------|
console.log(refreshToken);
console.log(cb);

}
));

routes.js

router.get('/auth/outlook',
passport.authenticate('oauth2',{
scope: outlookScope
})
);

router.get('/auth/outlook/callback',
passport.authenticate('oauth2',{
failureRedirect: '/' }),
function(req, res) {
// Successful authentication, redirect home.
// var authCode = req.code;
res.redirect('/account');
});

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions