I am working with OAuth Google API and I am getting the 401 Error: invalid_client
.
It is nothing to do with clientID or clientSecret code, because I'm sure that I copied the keys perfectly. I created again a new credential to make sure that it is not a problems of the Google API, but the error still exists. I also don't receive any error in the console when I am running the server. Could someone helps me, please?
It is what I receive from the browser:
> 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.
This is part of my code:
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'));
Thanks! :)