mirror of
https://github.com/strapi/strapi.git
synced 2025-11-12 16:22:10 +00:00
Fix Google auth
This commit is contained in:
parent
3cfeb645c1
commit
2b9e03f3de
@ -159,17 +159,37 @@ const getProfile = async (provider, query, callback) => {
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case 'google': {
|
case 'google': {
|
||||||
const google = new Purest({
|
const config = {
|
||||||
provider: 'google'
|
"google": {
|
||||||
});
|
"https://www.googleapis.com": {
|
||||||
|
"__domain": {
|
||||||
|
"auth": {
|
||||||
|
"auth": {"bearer": "[0]"}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"{endpoint}": {
|
||||||
|
"__path": {
|
||||||
|
"alias": "__default"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"oauth/[version]/{endpoint}": {
|
||||||
|
"__path": {
|
||||||
|
"alias": "oauth",
|
||||||
|
"version": "v3"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
var google = new Purest({provider: 'google', config})
|
||||||
|
|
||||||
google.query('plus').get('people/me').auth(access_token).request((err, res, body) => {
|
google.query('oauth').get('tokeninfo').qs({access_token}).request((err, res, body) => {
|
||||||
if (err) {
|
if (err) {
|
||||||
callback(err);
|
callback(err);
|
||||||
} else {
|
} else {
|
||||||
callback(null, {
|
callback(null, {
|
||||||
username: body.emails[0].value.split("@")[0],
|
username: body.email.split("@")[0],
|
||||||
email: body.emails[0].value
|
email: body.email
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user