Ghost/core/server/auth/ghost-auth.js
Katharina Irrgang 319a388277 ghost auth: sync email (#8027)
*   ghost auth: sync email

refs #7452

- sync email changes in background (every hour right now)
- sync logged in user only!
- no sync if auth strategy password is used
- GET /users/me is triggered on every page refresh
- added TODO to support or add long polling for syncing data later
- no tests yet on purpose, as i would like to get a basic review first

* 🐩  use events

- remember sync per user
2017-02-23 18:04:24 +00:00

20 lines
497 B
JavaScript

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