Last updated

setAuthentication()

Sets the authentication state for the current user.

Signature

window.FairShareSDK.setAuthentication(authData);

Parameters

ParameterTypeDescription
authDataobjectAuthentication data

AuthData Object:

PropertyTypeDescription
tokenstringAuthentication token
userobjectUser object

User Object:

PropertyTypeDescription
idnumberUser ID
namestringUser's display name
emailstringUser'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"
  }
});