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
exports.onExecutePostLogin=async(event,api)=>{constaxios=require('axios');constnamespace='https://api.<api-identifier-url>.com';// Auth0 API identifier// ATTACH CUSTOM CLAIMS// This makes these fields visible in req.auth.payload on your backendif(event.authorization){api.accessToken.setCustomClaim(`${namespace}/email`,event.user.email);api.accessToken.setCustomClaim(`${namespace}/nickname`,event.user.nickname||'',);api.accessToken.setCustomClaim(`${namespace}/displayName`,event.user.name||'',);}// User sync with backendif(!event.user.app_metadata.is_synced){constpayload={id: event.user.user_id,email: event.user.email,displayName: event.user.name||event.user.nickname||'',};try{awaitaxios.post(event.secrets.SYNC_URL,payload,{headers: {'x-sync-secret': event.secrets.INTERNAL_SYNC_SECRET,'ngrok-skip-browser-warning': 'true',},timeout: 5000,});api.user.setAppMetadata('is_synced',true);}catch(err){console.error('Sync failed, blocking login:',err.message);// If the DB is not reachable, no token providedapi.access.deny('Initialization failed. Please try again in a moment.');}}};