You are here

function oauth2_server_from_request in OAuth2 Server 7

Loads an OAuth2 server using the request details.

Parameters

\OAuth2\Request $request: The request.

Return value

OAuth2\Server An instance of OAuth2\Server.

3 calls to oauth2_server_from_request()
oauth2_server_revoke_page in ./oauth2_server.pages.inc
Page callback: revoke a token.
oauth2_server_token_page in ./oauth2_server.pages.inc
Page callback: exchanges an authorization code for an access token.
oauth2_server_userinfo in ./oauth2_server.pages.inc
Page callback: returns claims about the authenticated end-user.

File

./oauth2_server.module, line 978
Provides OAuth2 server functionality.

Code

function oauth2_server_from_request(\OAuth2\Request $request) {
  $client_credentials = oauth2_server_get_client_credentials($request);
  $server = NULL;
  if ($client_credentials) {
    $client = oauth2_server_client_load($client_credentials['client_id']);
    if ($client) {
      $server = oauth2_server_load($client->server);
    }
  }
  return oauth2_server_start($server);
}