Updating Discord image everytime the user logs in. #923

Closed
opened 2026-03-13 08:10:03 -05:00 by GiteaMirror · 3 comments
Owner

Originally created by @JustSxm on GitHub (Mar 27, 2025).

I was trying to do something which I think is fairly simple in theory :
I want the user's profile picture to update when they log in. The user may change his profile picture, which will make the one we saved on creation 404.

I tried with getUserInfo (which wont update the image in the bd).
Ive also tried to get the token in the bd (account table) to go fetch the image, but the access_token in accounts doesnt seem to be the discord token.

What am I doing wrong?
I took the time to read the entire documentation multiple times, but it seems like nothing explains to me how I could do that.

Originally created by @JustSxm on GitHub (Mar 27, 2025). I was trying to do something which I think is fairly simple in theory : I want the user's profile picture to update when they log in. The user may change his profile picture, which will make the one we saved on creation 404. I tried with getUserInfo (which wont update the image in the bd). Ive also tried to get the token in the bd (account table) to go fetch the image, but the access_token in accounts doesnt seem to be the discord token. What am I doing wrong? I took the time to read the entire documentation multiple times, but it seems like nothing explains to me how I could do that.
Author
Owner

@moshetanzer commented on GitHub (Mar 27, 2025):

Hey,

On successful login you can do a call to discord api and get image and update image.

@moshetanzer commented on GitHub (Mar 27, 2025): Hey, On successful login you can do a call to discord api and get image and update image.
Author
Owner

@JustSxm commented on GitHub (Mar 27, 2025):

I understand that, but where am I supposed to do that? You need access to the user's Discord token and you also need access to the user so you can update the user.

getUserInfo and map...toUser don't seem to be the places to do that. You can't do it on the signIn itself because fetchOptipn onSuccess doesn't allow to read the response body.

That's why it seems super hard for something that realistically shouldn't be

@JustSxm commented on GitHub (Mar 27, 2025): I understand that, but where am I supposed to do that? You need access to the user's Discord token and you also need access to the user so you can update the user. getUserInfo and map...toUser don't seem to be the places to do that. You can't do it on the signIn itself because fetchOptipn onSuccess doesn't allow to read the response body. That's why it seems super hard for something that realistically shouldn't be
Author
Owner

@JustSxm commented on GitHub (Mar 28, 2025):

Lost patience and switched of auth library.

@JustSxm commented on GitHub (Mar 28, 2025): Lost patience and switched of auth library.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/better-auth#923