mirror of
https://github.com/pacnpal/thrilltrack-explorer.git
synced 2025-12-21 13:31:13 -05:00
Fix: Correct Discord identity data access
This commit is contained in:
@@ -68,7 +68,21 @@ Deno.serve(async (req) => {
|
|||||||
console.log('[OAuth Profile] Processing profile for user:', user.id);
|
console.log('[OAuth Profile] Processing profile for user:', user.id);
|
||||||
|
|
||||||
const provider = user.app_metadata?.provider;
|
const provider = user.app_metadata?.provider;
|
||||||
const userMetadata = user.user_metadata;
|
|
||||||
|
// For Discord, data is in identities[0].identity_data, not user_metadata
|
||||||
|
let userMetadata = user.user_metadata;
|
||||||
|
if (provider === 'discord' && user.identities && user.identities.length > 0) {
|
||||||
|
const discordIdentity = user.identities.find(i => i.provider === 'discord');
|
||||||
|
if (discordIdentity) {
|
||||||
|
userMetadata = discordIdentity.identity_data || {};
|
||||||
|
console.log('[OAuth Profile] Using Discord identity data:', {
|
||||||
|
hasAvatar: !!userMetadata.avatar,
|
||||||
|
hasUsername: !!userMetadata.username,
|
||||||
|
hasGlobalName: !!userMetadata.global_name,
|
||||||
|
hasId: !!userMetadata.id
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
let avatarUrl: string | null = null;
|
let avatarUrl: string | null = null;
|
||||||
let displayName: string | null = null;
|
let displayName: string | null = null;
|
||||||
|
|||||||
Reference in New Issue
Block a user