User
The User section provides tools for managing user authentication state. These functions allow you to check if a user is logged in and set authentication after completing OAuth flows.
What's Included
| Function | Description |
|---|---|
| getAuthenticatedUser | Get the currently authenticated user |
| setAuthentication | Set authentication with JWT token |
Benefits
- Authentication State — Check if a user is currently logged in
- User Information — Access user details like name, email, and avatar
- OAuth Integration — Set authentication after completing OAuth flows
- Session Management — Programmatically manage user sessions
Quick Example
// Get authenticated user const user = window.FairShareSDK.getAuthenticatedUser(); if (user) { console.log('Logged in as:', user.name); } else { console.log('Not authenticated'); } // Set authentication with JWT token window.FairShareSDK.setAuthentication("your-jwt-token");
Related
- getAuthenticatedUser — Get authenticated user data
- setAuthentication — Set user authentication state