I am using "OAuth and Google Sign-In" and "Authorization code flow" in Account Linking of my actions on google app. I have written my own server using Passport js with the implementation of Google authentication in it and deployed it to Heroku. I tested it in the Browser and it works fine and successfully provide Access Token and Refresh Token, but the problem I am facing is when I integrate it with my action on google app it perform the authentication correctly and did not send the accessToken back to my app, I did not understand what should I put in the "Token URL" field. below is the code of server.
passport.use(new GoogleStrategy({
// authorizationURL: 'https://accounts.google.com/o/oauth2/auth',
// tokenURL: 'https://www.googleapis.com/oauth2/v3/token',
clientID: keys.googleClientID,
clientSecret: keys.googleClientSecret,
callbackURL: '/auth/google/callback'
},
(accessToken, refreshToken, profile, done) => {
return done(null, {
token: accessToken
})
}
));
app.get(
'/auth/google',
passport.authenticate('google', {
scope: ['profile', 'email']
})
);
app.get('/auth/google/callback',
passport.authenticate('google', {
failureRedirect: '/login'
}),
function(req, res) {
console.log(req.user.token)
res.send(req.user.token)
});
app.get('/', (req, res) => {
res.send('<h1>Hello express</h1>');
});
and here is the client information of my Google Assistant app.