You are here

function oauth2_server_send_response in OAuth2 Server 7

Sets the appropriate headers and outputs the response.

8 calls to oauth2_server_send_response()
oauth2_server_authorize_form_submit in ./oauth2_server.pages.inc
Submit callback for oauth2_server_authorize_form.
oauth2_server_authorize_page in ./oauth2_server.pages.inc
Page callback: Authenticates the user and redirect back to the client with an authorization code.
oauth2_server_revoke_page in ./oauth2_server.pages.inc
Page callback: revoke a token.
oauth2_server_services_authenticate_call in includes/oauth2_server.services_auth.inc
Services authentication "authenticate_call" callback.
oauth2_server_tokens_page in ./oauth2_server.pages.inc
Page callback: Returns information about the provided token.

... See full list

File

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

Code

function oauth2_server_send_response(OAuth2\Response $response) {
  $status = $response
    ->getStatusCode() . ' ' . $response
    ->getStatusText();
  drupal_add_http_header('Status', $status);
  drupal_add_http_header('Content-Type', 'application/json');
  foreach ($response
    ->getHttpHeaders() as $name => $header) {
    drupal_add_http_header($name, $header);
  }
  echo $response
    ->getResponseBody('json');
  drupal_exit();
}