function hook_oauth2_clients in OAuth2 Client 8
Same name and namespace in other branches
- 7.2 oauth2_client.api.php \hook_oauth2_clients()
Define oauth2 clients.
Return value
array Associative array of oauth2 clients.
1 function implements hook_oauth2_clients()
Note: this list is generated by pattern matching, so it may include some functions that are not actually implementations of this hook.
- oauth2_client_test_oauth2_clients in tests/
oauth2_client_test/ oauth2_client_test.module - Implements hook_oauth2_clients().
1 invocation of hook_oauth2_clients()
- oauth2_client_get_all in ./
oauth2_client.module - Gets all defined oauth2_clients.
File
- ./
oauth2_client.api.php, line 14 - Documentation of API functions provided by the oauth2_client module.
Code
function hook_oauth2_clients() {
global $base_url;
$server_url = 'https://oauth2_server.example.org';
$oauth2_clients = array();
// Using user-password flow.
$oauth2_clients['test1'] = array(
'token_endpoint' => $server_url . '/oauth2/token',
'auth_flow' => 'user-password',
'client_id' => 'client1',
'client_secret' => 'secret1',
'username' => 'user1',
'password' => 'pass1',
);
// Using client-credentials flow.
$oauth2_clients['test2'] = array(
'token_endpoint' => $server_url . '/oauth2/token',
'auth_flow' => 'client-credentials',
'client_id' => 'client2',
'client_secret' => 'secret2',
);
// Using server-side flow.
$oauth2_clients['test3'] = array(
'token_endpoint' => $server_url . '/oauth2/token',
'auth_flow' => 'server-side',
'client_id' => 'client3',
'client_secret' => 'secret3',
'authorization_endpoint' => $server_url . '/oauth2/authorize',
'redirect_uri' => $base_url . '/oauth2/authorized',
);
return $oauth2_clients;
}