getAuthenticatedUser()
Gets the currently authenticated user, if any.
Signature
const user = window.FairShareSDK.getAuthenticatedUser();
Returns
User | null — The authenticated user object, or null if no user is authenticated.
User Object:
| Property | Type | Description |
|---|---|---|
id | number | User ID |
name | string | User's display name |
email | string | User's email address |
avatar_url | string | URL to user's avatar image |
Example
const user = window.FairShareSDK.getAuthenticatedUser(); if (user) { console.log('User ID:', user.id); console.log('Name:', user.name); console.log('Email:', user.email); } else { console.log('No user authenticated'); }
Related
- User — User component
- setAuthentication — Set user authentication