Skip to content

Dosen't work authentication with google or facebook ... #942

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
maryampashmi opened this issue Apr 22, 2015 · 10 comments
Closed

Dosen't work authentication with google or facebook ... #942

maryampashmi opened this issue Apr 22, 2015 · 10 comments

Comments

@maryampashmi
Copy link

Hi,
With my understanding from documentation i execute only grunt serve , but i am getting error 401 while i select google authentication or any others.
That’s an error.
Error: invalid_client
The OAuth client was not found.
I am not sure if i need to execute somethings inside server such as node app.js or not? it is not written in documentation anythings about server side. How i can solve problem of authentication?
or following error from twitter:
Error: Could not authenticate you. at Strategy.parseErrorResponse (C:\Users\pasma08\WebstormProjects\CspMetadata\node_modules\passport-twitter\lib\strategy.js:182:10) at Strategy.OAuthStrategy._createOAuthError (C:\Users\pasma08\WebstormProjects\CspMetadata\node_modules\passport-twitter\node_modules\passport-oauth1\lib\strategy.js:349:16) at C:\Users\pasma08\WebstormProjects\CspMetadata\node_modules\passport-twitter\node_modules\passport-oauth1\lib\strategy.js:218:41 at C:\Users\pasma08\WebstormProjects\CspMetadata\node_modules\passport-twitter\node_modules\passport-oauth1\node_modules\oauth\lib\oauth.js:543:17 at passBackControl (C:\Users\pasma08\WebstormProjects\CspMetadata\node_modules\passport-twitter\node_modules\passport-oauth1\node_modules\oauth\lib\oauth.js:397:13) at IncomingMessage. (C:\Users\pasma08\WebstormProjects\CspMetadata\node_modules\passport-twitter\node_modules\passport-oauth1\node_modules\oauth\lib\oauth.js:409:9) at IncomingMessage.emit (events.js:129:20) at _stream_readable.js:908:16 at process._tickCallback (node.js:355:11)

Moreover in part of app.js inside server folder i am getting error from line exports = module.exports = app; after removing first exports, error disappear. Is that fine to remove first exports?

@maryampashmi maryampashmi changed the title Don't work authentication with google or facebook ... Dosen't work authentication with google or facebook ... Apr 22, 2015
@Awk34
Copy link
Member

Awk34 commented Apr 22, 2015

Have you registered your application with Facebook/Google+/Twitter and added the relevant API keys?

As to your second question AFAIK yeah that's fine.

@maryampashmi
Copy link
Author

Not at all. Where i should add relevant API key?
It good idea to write it in documentation. However i didn't get the problem while i am signing up through demo itself but through http://localhost:9000, yes.

@Awk34
Copy link
Member

Awk34 commented Apr 22, 2015

So first step is to register your app with those three providers. Just Google search "Facebook OAuth". For testing purposes, you'll want to use http://localhost:9000 as your site's domain so that the relevant authorities will accept your tests coming from your local box.

Then, find the server/config/local.env.sample.js file and copy it to server/config/local.env.js. Inside of the new file, copy the keys that you get from the developer's consoles of FB/Twitter/G+.

@Awk34
Copy link
Member

Awk34 commented Apr 22, 2015

I have Google+, Facebook, Twitter, LinkedIn, and GitHub OAuth working for my own site at http://andrewkoroluk.com. My code is at http://github.com/awk34/aksite if you're interested.

@remicastaing
Copy link
Contributor

Take a look to the config file. You will find the variables to hold the FB and G ID.

@maryampashmi
Copy link
Author

@Awk34 , I forgot to add that i was not able to enter finally. I didn't get what you wrote. you told me i copy from local.env.sample.js file to server/config/local.env.js. They are exactly the same. What i copy to what? The same things?
I saw your code. You have removed completely local.env.js and you keep only sample one.
I have copied of cliend id and client secret and i put in both files because i didn't realize difference between these two file finally.
GOOGLE_ID: 'xxxxxxxxxxx',
GOOGLE_SECRET: 'xxxxxxxxx',
Even though i kept one of them and take out the other to see what's happening. This is a error while i put client secret and id inside local.env.js. and i keep local.env.sample.js file as it is without chanaging and i got following error:
I would like to add i could solve this problem easily with twitter and facebook.Google is the only problem.
GET /login 200 27ms
[undefined:undefined] DISCONNECTED
GET /login 304 0ms
GET /auth/google 302 13ms - 0b

  1. That’s an error.
    Error: redirect_uri_mismatch

Application: CspMetadata
from_login=1
response_type=code
scope=https://www.googleapis.com/auth/userinfo.profile https://www.googleapis.com/auth/userinfo.email
redirect_uri=http://localhost:9000/auth/google/callback
as=6336fa57b6654b72
client_id=137082729569-dmalah8d76pbbkduobf9o7e974l9f90r.apps.googleusercontent.com
hl=es-ES

@maryampashmi
Copy link
Author

@remicastaing , where is this config file? and what i should do then? Shall i copy client_id and client_secret there?

@remicastaing
Copy link
Contributor

@maryampashmi, you will find it in server/config/local.env.js when you run your app locally (with grunt serve).
If you deploy your app, you have to copy your id and secret in environment variables.

@Awk34
Copy link
Member

Awk34 commented Apr 30, 2015

@maryampashmi the reason why you don't see my local.env.js is because it's not tracked by git. I still use it locally. If it were tracked by git, you would be able to see all of my API credentials!

Have you registered your app on the google developer's console using http://localhost:9000/auth/google/callback as the callback URI?

@maryampashmi
Copy link
Author

@Awk34 No,i didn't define it. In follwing link i have put json file for my configuration in google auth . link .

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants