admin管理员组文章数量:1391990
I’m using Passport.js with Google OAuth 2.0 in my Node.js app to authenticate users and request access to Google Calendar events. Despite adding the calendar.events scope in both my Passport strategy and Google Cloud Console, the consent screen does not prompt for calendar access, and the returned access token is missing the calendar.events scope.
What I’ve tried:
Added calendar.events in the Passport strategy:
`passport.use(
new GoogleStrategy(
{
clientID: process.env.GOOGLE_CLIENT_ID,
clientSecret: process.env.GOOGLE_CLIENT_SECRET,
callbackURL: process.env.BACKEND_HOST + "/auth/google/callback",
scope: [
"email",
".events"
],
accessType: "offline",
prompt: "consent",
},
async (accessToken, refreshToken, profile, done) => {
console.log("access token", accessToken);
const response = await fetch(
"=" +
accessToken
);
const data = await response.json();
console.log("Token Info:", data);
}
)
);`
Verified that calendar.events is added in the Google Cloud Console under OAuth consent screen.
Tested with to inspect the access token — only the default userinfo.email, userinfo.profile, and openid scopes are present.
Added prompt: "consent" and accessType: "offline" to force re-consent.
Revoked access via Google Permissions and retried, but still no prompt for calendar access.
Expected behavior:
The Google consent screen should prompt for calendar access when logging in. The access token should include the calendar.events scope. Actual behavior:
No calendar permission prompt is shown, and the token is missing the calendar.events scope. What could be causing this?
Is there any additional configuration required to request calendar.events? Could it be related to how Passport.js handles the scope?
本文标签: javascriptGoogle OAuth not requesting calendarevents scope in Nodejs with PassportjsStack Overflow
版权声明:本文标题:javascript - Google OAuth not requesting calendar.events scope in Node.js with Passport.js - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1744746353a2622902.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论