mirror of
https://github.com/TryGhost/Ghost.git
synced 2025-02-03 23:00:14 -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:
parent
ea0f696c4d
commit
e0cd5b55ce
2 changed files with 3 additions and 3 deletions
|
@ -4,11 +4,11 @@ var passport = require('passport'),
|
||||||
module.exports.getUser = function getUser(options) {
|
module.exports.getUser = function getUser(options) {
|
||||||
options = options || {};
|
options = options || {};
|
||||||
|
|
||||||
var token = options.token,
|
var id = options.id,
|
||||||
ghostOAuth2Strategy = passport._strategies.ghost;
|
ghostOAuth2Strategy = passport._strategies.ghost;
|
||||||
|
|
||||||
return new Promise(function (resolve, reject) {
|
return new Promise(function (resolve, reject) {
|
||||||
ghostOAuth2Strategy.userProfile(token, function (err, profile) {
|
ghostOAuth2Strategy.userProfileByIdentityId(id, function (err, profile) {
|
||||||
if (err) {
|
if (err) {
|
||||||
return reject(err);
|
return reject(err);
|
||||||
}
|
}
|
||||||
|
|
|
@ -25,7 +25,7 @@ _private.syncUser = function syncUser(loggedInUserModel) {
|
||||||
}
|
}
|
||||||
|
|
||||||
return ghostAuth.getUser({
|
return ghostAuth.getUser({
|
||||||
token: loggedInUserModel.get('ghost_auth_access_token')
|
id: loggedInUserModel.get('ghost_auth_id')
|
||||||
}).then(function (ghostUser) {
|
}).then(function (ghostUser) {
|
||||||
debug('ghost_email', ghostUser.email);
|
debug('ghost_email', ghostUser.email);
|
||||||
debug('user_email', loggedInUserModel.get('email'));
|
debug('user_email', loggedInUserModel.get('email'));
|
||||||
|
|
Loading…
Add table
Reference in a new issue