You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm trying to integrate google classroom in my nextjs app. So, I need to add the scopes for that in google provider. If I do that, it's not working or adding scopes when I log in.
When I console scopes granted for access token, it only returns user scopes. Not the scopes I added for google classroom
Here's the code for [...nextauth].js
`import NextAuth from 'next-auth';
import GoogleProvider from 'next-auth/providers/google';
Question 馃挰
I'm trying to integrate google classroom in my nextjs app. So, I need to add the scopes for that in google provider. If I do that, it's not working or adding scopes when I log in.
When I console scopes granted for access token, it only returns user scopes. Not the scopes I added for google classroom
Here's the code for [...nextauth].js
`import NextAuth from 'next-auth';
import GoogleProvider from 'next-auth/providers/google';
const scopes = [
'https://www.googleapis.com/auth/userinfo.profile',
'https://www.googleapis.com/auth/userinfo.email',
'https://www.googleapis.com/auth/classroom.courses.readonly',
'https://www.googleapis.com/auth/classroom.coursework.students.readonly',
'https://www.googleapis.com/auth/classroom.coursework.me.readonly',
'https://www.googleapis.com/auth/classroom.coursework.me',
'https://www.googleapis.com/auth/classroom.coursework.students',
];
export const authOptions = {
providers: [
GoogleProvider({
clientId: process.env.GOOGLE_CLIENT_ID,
clientSecret: process.env.GOOGLE_CLIENT_SECRET,
scope: scopes.join(' '),
authorization: {
params: {
prompt: 'consent',
access_type: 'offline',
response_type: 'code',
},
},
}),
],
callbacks: {
async jwt({ token, account, profile }) {
if (account) {
token.accessToken = account.access_token;
token.refreshToken = account.refresh_token;
token.id = profile.id;
}
return token;
},
async session(session, token) {
return session;
},
},
};
export default NextAuth(authOptions);
`
How to reproduce 鈽曪笍
Contributing 馃檶馃徑
Yes, I am willing to help answer this question in a PR
The text was updated successfully, but these errors were encountered: