function brightcove_verify_tokens in Brightcove Video Connect 7.3
Same name and namespace in other branches
- 7.2 brightcove.module \brightcove_verify_tokens()
- 7.4 brightcove.module \brightcove_verify_tokens()
- 7.5 brightcove.module \brightcove_verify_tokens()
Verifies the brightcove API keys.
Parameters
string $read_token: An optional read token instead of the stored one.
string $write_token: An optional write token instead of the stored one.
Return value
array A touple of booleans as the result of the verification. The first item is TRUE if the read key is correct. The second item is TRUE if the write key is correct.
1 call to brightcove_verify_tokens()
File
- ./
brightcove.module, line 766 - Brightcove module is an integration layer between any modules using Brightcove API. It makes all necessary checks for the API and makes settings available to the user.
Code
function brightcove_verify_tokens($read_token = NULL, $write_token = NULL) {
$bc = brightcove_initialize($read_token, $write_token);
$read = FALSE;
try {
$read = $bc
->find('videobyid', 0) || TRUE;
} catch (Exception $e) {
watchdog_exception('brightcove', $e);
}
try {
$bc
->getStatus('video', 0, 0);
$write = TRUE;
} catch (Exception $e) {
$write = stripos($e
->getMessage(), 'token') === FALSE;
}
return array(
$read,
$write,
);
}