edit : here is a minimally viable project
I am trying to access and update a token from Google using an authorization code for a server-side stream. I followed the Google Guide here: https://developers.google.com/identity/sign-in/web/server-side-flow .
I use passport and passport-google-authcode .
Following are the routes for the node application:
router.get('/auth/google_auth_code', passport.authenticate('google_authcode', { scope: [ 'https://www.googleapis.com/auth/calendar', 'profile', 'https://www.googleapis.com/auth/userinfo.email' ] }), function () { res.end(); }) router.get('/auth/google_auth_code/callback', passport.authenticate('google_authcode', { failureRedirect: '/error' }), function (req, res) {
Here is the config passport for this strategy.
passport.use('google_authcode', new GoogleAuthCodeStrategy({ clientID: 'my client id', clientSecret: 'my secret', callbackURL: '/auth/google_auth_code/callback', // passReqToCallback: true }, function (accessToken, refreshToken, rawResponse, profile, done) { // unable to get here } ));
When an authentication request is executed, Google responds with the following error:
{ "error" : "invalid_request", "error_description" : "Invalid parameter value for redirect_uri: Missing scheme: /auth/google_auth_code/callback" }
Here is my credential setting in the Google console:

At this moment I do not know what else to do. I also tried changing the callback url in the passport.use file to an absolute url. I definitely return a valid authorization code (it looks like this: 4/Mb2pcOyhYhziROyFHKH5pnzvUldYbAmMop9SJKbBHXQ ). Let me know if there is any more important information that I can provide.
Thanks,
Sam
change
I noticed that I have URLs ending with a slash above. I fixed this, but I did not update the screenshot.
If I use the full url (e.g. http: // localhost: 8080 // auth / google_auth_code / callback ), I get the following error:
{ "error" : "unauthorized_client" }
If I use the full url (e.g. http: // localhost: 8080 / auth / google_auth_code / callback ), I get the following error:
{ "error" : "redirect_uri_mismatch" }