Spioune
Spioune
Explore posts from servers
CCConvex Community
Created by fartinmartin on 3/2/2025 in #support-community
Add access token from OAuth provider
I guess storing them in the user table is fine.
13 replies
CCConvex Community
Created by fartinmartin on 3/2/2025 in #support-community
Add access token from OAuth provider
I am not familiar with convex auth, I thought they use the same config as auth.js
13 replies
CCConvex Community
Created by fartinmartin on 3/2/2025 in #support-community
Add access token from OAuth provider
If you console.log every arguments of callback createOrUpdateUser() do you see anything useful?
13 replies
CCConvex Community
Created by fartinmartin on 3/2/2025 in #support-community
Add access token from OAuth provider
Yes and I think if you try to fetch Spotify API from the browser you would get CORS error anyway. You should do it from the server.
13 replies
CCConvex Community
Created by fartinmartin on 3/2/2025 in #support-community
Add access token from OAuth provider
providers: [
Providers.Spotify({
clientId: process.env.SPOTIFY_ID,
clientSecret: process.env.SPOTIFY_SECRET,
})
],
callbacks: {
async jwt(token, _, account) {
if (account) {
token.id = account.id
token.accessToken = account.accessToken
}
return token
},
async session(session, user) {
session.user = user
return session
}
}
providers: [
Providers.Spotify({
clientId: process.env.SPOTIFY_ID,
clientSecret: process.env.SPOTIFY_SECRET,
})
],
callbacks: {
async jwt(token, _, account) {
if (account) {
token.id = account.id
token.accessToken = account.accessToken
}
return token
},
async session(session, user) {
session.user = user
return session
}
}
13 replies
CCConvex Community
Created by fartinmartin on 3/2/2025 in #support-community
Add access token from OAuth provider
See here in the JWT callback you have access to account.access_token
13 replies
CCConvex Community
Created by fartinmartin on 3/2/2025 in #support-community
Add access token from OAuth provider
13 replies
CCConvex Community
Created by fartinmartin on 3/2/2025 in #support-community
Add access token from OAuth provider
I don't think you should send it to the client.
13 replies
CCConvex Community
Created by fartinmartin on 3/2/2025 in #support-community
Add access token from OAuth provider
Convex auth aside, what you would normally do is after the user log in with Spotify, he would be redirected to your Spotify callback. In there you have access to the access token, you can save it to the database (maybe can save the refresh token too)
13 replies