我该如何修复Google OAuth 401错误无效客户端?
我正在使用OAuth Google API,并且正在获取401 Error: invalid_client
。它与clientID或clientSecret代码无关,因为我确定我复制的密钥是完美的。我再次创建了一个新凭据,以确保它不是Google API的问题,但错误仍然存在。运行服务器时,控制台中也没有收到任何错误。有人可以帮我吗?
这是我从浏览器中收到的:
> 401. That’s an error. > > Error: invalid_client > > The OAuth client was not found. > > Request Details > response_type=code > redirect_uri=http://localhost:5000/auth/google/callback > scope=profile email > client_id=keys.googleClientID > That’s all we know.
这是我的代码的一部分:
passport.use(
new GoogleStrategy(
{
clientID: 'keys.googleClientID',
clienSecret: 'keys.googleClientSecret',
callbackURL: '/auth/google/callback'
},
(accessToken, refreshToken, profile, done) => {
console.log('access token', accessToken);
console.log('refresh token', refreshToken);
console.log('profile', profile);
}
)
);
app.get(
'/auth/google',
passport.authenticate('google',{
scope: ['profile', 'email']
})
);
app.get('/auth/google/callback', passport.authenticate('google'));
谢谢! :)
回答如下:您应确保已启用Google+ API,并且此Similar Fixes 可以为您提供帮助
我该如何修复Google OAuth 401错误无效客户端?
我正在使用OAuth Google API,并且正在获取401 Error: invalid_client
。它与clientID或clientSecret代码无关,因为我确定我复制的密钥是完美的。我再次创建了一个新凭据,以确保它不是Google API的问题,但错误仍然存在。运行服务器时,控制台中也没有收到任何错误。有人可以帮我吗?
这是我从浏览器中收到的:
> 401. That’s an error. > > Error: invalid_client > > The OAuth client was not found. > > Request Details > response_type=code > redirect_uri=http://localhost:5000/auth/google/callback > scope=profile email > client_id=keys.googleClientID > That’s all we know.
这是我的代码的一部分:
passport.use(
new GoogleStrategy(
{
clientID: 'keys.googleClientID',
clienSecret: 'keys.googleClientSecret',
callbackURL: '/auth/google/callback'
},
(accessToken, refreshToken, profile, done) => {
console.log('access token', accessToken);
console.log('refresh token', refreshToken);
console.log('profile', profile);
}
)
);
app.get(
'/auth/google',
passport.authenticate('google',{
scope: ['profile', 'email']
})
);
app.get('/auth/google/callback', passport.authenticate('google'));
谢谢! :)
回答如下:您应确保已启用Google+ API,并且此Similar Fixes 可以为您提供帮助