0
Fork 0
mirror of https://github.com/TryGhost/Ghost.git synced 2025-01-20 22:42:53 -05:00

🎨 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
This commit is contained in:
Katharina Irrgang 2017-03-13 20:49:30 +01:00 committed by Hannah Wolfe
parent ea0f696c4d
commit e0cd5b55ce
2 changed files with 3 additions and 3 deletions

View file

@ -4,11 +4,11 @@ var passport = require('passport'),
module.exports.getUser = function getUser(options) {
options = options || {};
var token = options.token,
var id = options.id,
ghostOAuth2Strategy = passport._strategies.ghost;
return new Promise(function (resolve, reject) {
ghostOAuth2Strategy.userProfile(token, function (err, profile) {
ghostOAuth2Strategy.userProfileByIdentityId(id, function (err, profile) {
if (err) {
return reject(err);
}

View file

@ -25,7 +25,7 @@ _private.syncUser = function syncUser(loggedInUserModel) {
}
return ghostAuth.getUser({
token: loggedInUserModel.get('ghost_auth_access_token')
id: loggedInUserModel.get('ghost_auth_id')
}).then(function (ghostUser) {
debug('ghost_email', ghostUser.email);
debug('user_email', loggedInUserModel.get('email'));