passport-token-google
Advanced tools
Comparing version 0.1.2 to 0.1.4
@@ -109,3 +109,3 @@ /** | ||
GoogleTokenStrategy.prototype.userProfile = function(accessToken, done) { | ||
var profileUrl = 'https://www.googleapis.com/oauth2/v3/tokeninfo?id_token='+accessToken; | ||
var profileUrl = 'https://www.googleapis.com/oauth2/v3/tokeninfo?access_token='+accessToken; | ||
this._oauth2.get(profileUrl, null, function (err, body, res) { | ||
@@ -118,3 +118,3 @@ if (err) { return done(new InternalOAuthError('failed to fetch user profile', err)); } | ||
var profile = { provider: 'google' }; | ||
profile.id = json.id; | ||
profile.id = json.id || json.sub; | ||
profile.displayName = json.name; | ||
@@ -121,0 +121,0 @@ profile.name = { familyName: json.family_name, |
{ | ||
"name": "passport-token-google", | ||
"version": "0.1.2", | ||
"version": "0.1.4", | ||
"description": "Google token authentication strategy for Passport.", | ||
"author": { | ||
"name": "Davide Polano", | ||
"email": "info@mdslab.org" | ||
"name": "Satyarth Upadhyaya", | ||
"email": "satyarth7a@hotmail.com" | ||
}, | ||
"scripts": { | ||
"push": "sh version-to-tag.sh && npm publish" | ||
}, | ||
"repository": { | ||
"type": "git", | ||
"url": "git://github.com/davidep87/passport-token-google.git" | ||
"url": "git://github.com/katastreet/passport-token-google.git" | ||
}, | ||
"bugs": { | ||
"url": "http://github.com/davidep87/passport-token-google/issues" | ||
"url": "http://github.com/katastreet/passport-token-google/issues" | ||
}, | ||
@@ -36,4 +39,5 @@ "main": "./lib", | ||
"authentication", | ||
"identity" | ||
"identity", | ||
"loopback" | ||
] | ||
} |
@@ -15,3 +15,3 @@ # Passport-Token-Google | ||
$ npm install passport-token-google | ||
$ npm install passport-token-google2 | ||
@@ -27,3 +27,3 @@ ## Usage | ||
const GoogleStrategy = require('passport-token-google').Strategy | ||
const GoogleStrategy = require('passport-token-google2').Strategy | ||
@@ -50,2 +50,28 @@ passport.use(new GoogleStrategy({ | ||
GET request need to have `access_token` and optionally the `refresh_token` in either the query string or set as a header. If a POST is being preformed they can also be included in the body of the request. | ||
GET request need to have `id_token` sent as `access_token` in either the query string or set as a header. If a POST is being preformed they can also be included in the body of the request. | ||
#### Loopback 3.X support | ||
Complaint with UserIdentity and User model of loopback | ||
The module can be used to authenticate `id_token` sent by client side(android,ios or web) on the loopback as `access_token` in the callbackPath as GET argument. | ||
Add this to providers.json as described in [tutorial!](https://loopback.io/doc/en/lb3/Third-party-login-using-Passport.html). | ||
``` | ||
"google-login": { | ||
"provider": "google", | ||
"module": "passport-token-google2", | ||
"clientID": "{google-client-id-1}", | ||
"clientSecret": "{google-client-secret-1}", | ||
"callbackPath": "/auth/google/token", | ||
"scope": ["email", "profile"], | ||
"failureFlash": true, | ||
"json": true, | ||
"session": false | ||
} | ||
``` | ||
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
13028
6
75