Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions forge/ee/routes/sso/social/google.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,12 @@ module.exports = fp(async function (app, opts) {
// We need to decode and verify it.
const googleOAuth2Client = new OAuth2Client(clientId)
try {
const tokenInfo = await googleOAuth2Client.getTokenInfo(request.query.code)
if (tokenInfo.aud !== clientId) {
reply.code(400).send({ code: 'invalid_request', error: 'Invalid code' })
return
}
// Now get the user info
googleOAuth2Client.setCredentials({ access_token: request.query.code })
const userinfo = await googleOAuth2Client.request({
url: 'https://www.googleapis.com/oauth2/v3/userinfo'
Expand Down
Loading