setAuthentication()
Sets the authentication state for the current user.
Signature
window.FairShareSDK.setAuthentication(authData);
Parameters
| Parameter | Type | Description |
|---|---|---|
authData | object | Authentication data |
AuthData Object:
| Property | Type | Description |
|---|---|---|
token | string | Authentication token |
user | object | User object |
User Object:
| Property | Type | Description |
|---|---|---|
id | number | User ID |
name | string | User's display name |
email | string | User's email address |
Example
// Set authentication after OAuth flow window.FairShareSDK.setAuthentication({ token: "user-auth-token", user: { id: 123, name: "John Doe", email: "john@example.com" } });
Related
- User — User component
- getAuthenticatedUser — Get authenticated user