Replies: 2 comments 1 reply
-
|
Beta Was this translation helpful? Give feedback.
-
This is my workaround for getting the discord user snowflake (ID) using database sessions without using email as a scope. providers: [
DiscordProvider({
clientId: process.env.DISCORD_CLIENT_ID,
clientSecret: process.env.DISCORD_CLIENT_SECRET,
authorization: { params: { scope: 'identify' } },
profile: (profile) => {
let userAvatar = `https://cdn.discordapp.com/avatars/${profile.id}/${profile.avatar}.png`
return {
id: profile.id,
snowflake: profile.id,
name: profile.username,
image: userAvatar,
}
},
}),
], I noticed that in the signIn callback, the first time the user logs in, user.id returns the users discord ID and future log ins return the default id set by Snowflake can be accessed in session by using the callback async session({ session, user, token }) {
session.snowflake = user.snowflake
return Promise.resolve(session)
}, Not sure if this is the right way to do it but it works - might be worth expanding the docs for this provider. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Question 💬
Using the default DiscordProvider doesn't seem to be returning an object with ID, name, email and image.
I for some reason only get a object user object with, name, email and image.
I am simply using the default provider without any additional settings
How to reproduce ☕️
providers: [ DiscordProvider({ clientId: process.env.DISCORD_CLIENT_ID, clientSecret: process.env.DISCORD_CLIENT_SECRET, }), ],
Contributing 🙌🏽
No, I am afraid I cannot help regarding this
Beta Was this translation helpful? Give feedback.
All reactions