Ethan Wu
Ethan Wu

Reputation: 183

InternalOAuthError when using nodejs passport to integration third party platform

I want to use passport(using paasport-facebook and qq) to authenticate user. But meeting the following error: when I using facebook auth:

error when auth: { [InternalOAuthError: Failed to obtain access token]
name: 'InternalOAuthError',
message: 'Failed to obtain access token',
oauthError: [Error: Hostname/IP doesn't match certificate's altnames] }

when I using qq auth,I got this:

name: 'InternalOAuthError',
message: 'failed to obtain access token',
oauthError: [Error: CERT_UNTRUSTED] }

Here is my /etc/hosts file:

127.0.0.1       www.siyee.org
127.0.0.1       localhost
255.255.255.255 broadcasthost
::1             localhost

because the auth callback must be a domain, so I changed the hosts on my development environment to match the callback settings on the facebook server.It's not smart but can take effect.Any better idea?

I think the problem is in my hosts setting or certificate, but I don't know how to fix it, any kind of help would be great!

Upvotes: 1

Views: 1614

Answers (1)

Nikolay Melnikov
Nikolay Melnikov

Reputation: 1395

First I had to specify access to userinfo and only then - other necessary services.

    scope: [
        'https://www.googleapis.com/auth/userinfo.profile',
        'https://www.googleapis.com/auth/userinfo.email',
        'https://www.googleapis.com/auth/youtube'
    ]

Upvotes: 1

Related Questions