You are here

function oauth2_client_load in OAuth2 Client 7

Same name and namespace in other branches
  1. 8 oauth2_client.module \oauth2_client_load()
  2. 8 oauth2_client.api.php \oauth2_client_load()
  3. 7.2 oauth2_client.module \oauth2_client_load()
  4. 7.2 oauth2_client.api.php \oauth2_client_load()

Load an oauth2 client.

Parameters

string $name: Name of the client.

Return value

OAuth2\Client Returns an OAuth2\Client object

1 call to oauth2_client_load()
oauth2_client_test_callback in tests/oauth2_client_test.module
Trying test clients.

File

./oauth2_client.module, line 39
Provides OAuth2 client functionality.

Code

function oauth2_client_load($name) {
  $oauth2_clients = oauth2_client_get_all();
  if (!isset($oauth2_clients[$name])) {
    throw new Exception("No client with name '{$name}' is defined.");
  }
  $oauth2_client = new OAuth2\Client($oauth2_clients[$name], $name);
  return $oauth2_client;
}