Skip to content
This repository was archived by the owner on Mar 22, 2022. It is now read-only.

Unable to authenticate with passport-google-oauth20 #295

Closed
EugeneZ opened this issue Sep 24, 2016 · 4 comments
Closed

Unable to authenticate with passport-google-oauth20 #295

EugeneZ opened this issue Sep 24, 2016 · 4 comments

Comments

@EugeneZ
Copy link

EugeneZ commented Sep 24, 2016

I can't seem to get Google OAUTH2 working. I thought it must be me, so I took the feathers-oauth2-authentication project from the feathers-demos repo, which uses GitHub, and ran it. It worked. I replaced the passport-github package with passport-facebook (which is very similar to Google's), replaced the link in index.html, changed github to facebook in the configuration object, and updated the ids. This also worked. I performed the same exact steps but with the passport-google-oauth20 package. It gets as far as Google's page asking me for permission to see my public profile, etc, but when I approve, the callback that it redirects to forwards me to the failure page. Looking at the redirect, it looks like Google did the right thing and forwarded state=true and some sort of token, just like Facebook does. Any ideas?

@marshallswain
Copy link
Member

@EugeneZ have you tried using the generator and letting it build the Google OAuth setup for you?

@EugeneZ
Copy link
Author

EugeneZ commented Sep 25, 2016

I did not, but I just went and set it up. All I did was set up a new repo, babel (as per the guide), feathers generate with all defaults except google for auth and memory for db. Added my oauth ids to the config and added a link to /auth/google to index.html. No good, same exact problem... Google asks for password and then forwards to callback, which then forwards to failure.

@EugeneZ
Copy link
Author

EugeneZ commented Sep 25, 2016

Ever had that thing where shortly after opening an issue you figure out the problem even though you thought you tried everything before opening it? Yeah. That. Sorry!

For those interested, turns out you have to enable the Google+ API from your API dashboard (I had to also enable the Gmail API, might be the permissions I'm requesting). See here: jaredhanson/passport-google-oauth#46

@EugeneZ EugeneZ closed this as completed Sep 25, 2016
@marshallswain
Copy link
Member

Glad you got it worked out
On Sat, Sep 24, 2016 at 11:31 PM EugeneZ notifications@github.com wrote:

Closed #295
#295.


You are receiving this because you commented.
Reply to this email directly, view it on GitHub
#295 (comment),
or mute the thread
https://github.com/notifications/unsubscribe-auth/AAH3WVqlQ_71wNvTN0cxWPeHl_TfL6dYks5qtgdEgaJpZM4KFvLD
.

# for free to subscribe to this conversation on GitHub. Already have an account? #.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants