USER_TOKENS_TABLE
USER_TOKENS_TABLE
Represents a user who either has or is in the process of acquiring an API access token via OAuth
__construct(string $consumerKey, string $userId, \mysqli $mysqli)
Create a new UserAPIToken to either register a new user in the USER_TOKENS_TABLE or look up an existing user.
string | $consumerKey | The unique ID of the Tool Consumer from whence the user is making requests to the LTI |
string | $userId | The unique ID of the user within that Tool Consumer |
\mysqli | $mysqli | An active MySQL database connection to update USER_TOKEN_TABLE |
CONSUMER_KEY_REQUIRED If no consumer key is provided
USER_ID_REQUIRED If no user ID is provided
MYSQLI_REQUIRED If no MySQL database connection is provided
MYSQLI_ERROR If the user cannot be found or inserted in USER_TOKEN_TABLE
setToken(string $token) : boolean
Stores a new API Token into USER_TOKEN_TABLE for this user
string | $token | A new API access token for this user |
TOKEN_REQUIRED If no token is provided
Returns TRUE if the token is successfully stored in USER_TOKEN_TABLE, FALSE otherwise
setAPIEndpoint(string $endpoint) : boolean
Stores a new URL for the API endpoint for which the user's API access token is valid in USER_TOKEN_TABLE
string | $endpoint | The URL of the API endpoint |
ENDPOINT_REQUIRED If no endpoint is provided
TRUE if the URL of the API endpoint is stored in USER_TOKEN_TABLE, FALSE otherwise