Ghost/core/server/auth/ghost-auth.js
Katharina Irrgang e0cd5b55ce 🎨 fetch user profile by auth id (#8110)
no issue

- this is secured by client credentials
- you can only fetch the user info if the user is connected to your blog (invited, owner)
- passport ghost instance stores the client credentials in the instance, no need to pass them into
- tested on staging
2017-03-13 19:49:30 +00:00

20 lines
500 B
JavaScript

var passport = require('passport'),
Promise = require('bluebird');
module.exports.getUser = function getUser(options) {
options = options || {};
var id = options.id,
ghostOAuth2Strategy = passport._strategies.ghost;
return new Promise(function (resolve, reject) {
ghostOAuth2Strategy.userProfileByIdentityId(id, function (err, profile) {
if (err) {
return reject(err);
}
resolve(profile);
});
});
};