Permalink
Browse files

add cors support to exception responses, include proper content heade…

…rs in auth exception response
  • Loading branch information...
1 parent b79d866 commit a4d2ab6ce1399db4021b925730eee58943091a18 @tdupreeibp tdupreeibp committed May 18, 2012
@@ -56,6 +56,7 @@ public function __construct($httpCode, $tokenType, $realm, $error, $error_descri
* @ingroup oauth2_section_5
*/
protected function sendHeaders() {
+ parent::sendHeaders();
header($this->header);
}
}
@@ -64,6 +64,8 @@ public function getHttpCode() {
public function sendHttpResponse() {
$this->sendHeaders();
header("HTTP/1.1 " . $this->getHttpCode());
+ // Allow all origins. This enables CORS requests to properly handle the response.
+ header('Access-Control-Allow-Origin: *');
echo (string) $this;
exit();
}

0 comments on commit a4d2ab6

Please sign in to comment.