归档
This commit is contained in:
28
oauth2/auth.php
Normal file
28
oauth2/auth.php
Normal file
@@ -0,0 +1,28 @@
|
||||
<?php
|
||||
require_once __DIR__.'/server.php';
|
||||
$request = OAuth2\Request::createFromGlobals();
|
||||
$response = new OAuth2\Response();
|
||||
if (!$server->validateAuthorizeRequest($request, $response)) {
|
||||
$code = array(
|
||||
"code"=>400,
|
||||
"msg"=>$response->getParameter("error_description")
|
||||
);
|
||||
die(json_encode($code,JSON_UNESCAPED_UNICODE));
|
||||
}
|
||||
|
||||
if (empty($_POST)) {
|
||||
$scopes=$_GET['scope'];
|
||||
if (empty($scopes)){
|
||||
$code = array(
|
||||
"code"=>401,
|
||||
"msg"=>"权限点信息(scope)不应为空"
|
||||
);
|
||||
die(json_encode($code,JSON_UNESCAPED_UNICODE));
|
||||
}
|
||||
include ROOT.'page/oauth2/auth.php';
|
||||
die();
|
||||
}
|
||||
// print the authorization code if the user has authorized your client
|
||||
$is_authorized = ($_POST['authorized'] === 'yes');
|
||||
$server->handleAuthorizeRequest($request, $response, $is_authorized,$cookie::get('uid'));
|
||||
$response->send();
|
||||
Reference in New Issue
Block a user