在使用nodejs passport来集成第三方平台时,发生InternalOAuthError

我想使用护照(使用paasport-facebook和QQ)来validation用户。 但遇到以下错误:当我使用Facebook身份validation:

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] } 

当我使用QQ身份validation,我得到这个:

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

这是我的/ etc / hosts文件:

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

因为authcallback必须是域名,所以我改变了我的开发环境中的主机,以匹配Facebook服务器上的callback设置。它不是很聪明,但可以生效。任何更好的主意?

我认为这个问题是在我的主机设置或证书,但我不知道如何解决它,任何forms的帮助将是伟大的!

首先,我必须指定访问userinfo ,然后才能指定其他必要的服务。

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