我已经设置了一个google登录api,并且正在运行,现在我想使用相同的api获取用户当前的城市和州。 是否可以在其他用户信息中添加诸如location之类的参数?
passport.use(new GoogleStrategy({
clientID: "306372003149-
sivvertbnf0h2a2q9sdbl1in0t9d4ch2.apps.googleusercontent.com",
clientSecret: "zlIQubC8WvEMzOq4HZxApCvc",
callbackURL: "https://dev.stribein.com/auth/google/callback",
passReqToCallback: true
},
function (req, accessToken, refreshToken, profile, done) {
var self = this;
console.log('access token=>>>>', accessToken);
console.log('refreshToken=>>>>>', refreshToken);
console.log('profile=>>>>>>>',profile);
// if(req.session.passport)
结果:
profile=>>>>>>> { id: '115008617689708185825',
displayName: 'Mohammad Saif Himayat',
name: { familyName: 'Himayat', givenName: 'Mohammad Saif' },
emails: [ { value: 'mohammad.saif@unicodesystems.org', type: 'account' } ],
photos: [ { value: 'https://lh5.googleusercontent.com/-hUvMvp5MEBk/AAAAAAAAAAI/AAAAAAAAABI/zlEFH4F1DiM/s50/photo.jpg' } ],
gender: undefined,
provider: 'google',
_raw: '{\n "kind": "plus#person",\n "etag": "\\"4DZKD8nJom0F9AKh7PGs_B0kK-A/wPI1xKgQC-V8jMnJRcRWg7mejD0\\"",\n "emails": [\n {\n "value": "mohammad.saif@unicodesystems.org",\n "type": "account"\n }\n ],\n "id": "115008617689708185825",\n "displayName": "Mohammad Saif Himayat",\n "name": {\n "familyName": "Himayat",\n "givenName": "Mohammad Saif"\n },\n "image": {\n "url": "https://lh5.googleusercontent.com/-hUvMvp5MEBk/AAAAAAAAAAI/AAAAAAAAABI/zlEFH4F1DiM/s50/photo.jpg",\n "isDefault": false\n },\n "language": "en",\n "domain": "unicodesystems.org"\n}\n',
_json:
{ kind: 'plus#person',
etag: '"4DZKD8nJom0F9AKh7PGs_B0kK-A/wPI1xKgQC-V8jMnJRcRWg7mejD0"',
emails: [ [Object] ],
id: '115008617689708185825',
displayName: 'Mohammad Saif Himayat',
name: { familyName: 'Himayat', givenName: 'Mohammad Saif' },
image:
{ url: 'https://lh5.googleusercontent.com/-hUvMvp5MEBk/AAAAAAAAAAI/AAAAAAAAABI/zlEFH4F1DiM/s50/photo.jpg',
isDefault: false },
language: 'en',
domain: 'unicodesystems.org' } }
期望:
我只想在此结果中添加一个位置参数。