mirror of
https://github.com/elyby/oauth2-server.git
synced 2024-12-23 05:29:52 +05:30
Code tidy
This commit is contained in:
parent
4f053bb63a
commit
784af67367
@ -18,16 +18,14 @@ $server->addRepository(new AccessTokenRepository());
|
|||||||
// Enable the client credentials grant which will return access tokens that last for 24 hours
|
// Enable the client credentials grant which will return access tokens that last for 24 hours
|
||||||
$server->enableGrantType('ClientCredentialsGrant', null, new \DateInterval('PT24H'));
|
$server->enableGrantType('ClientCredentialsGrant', null, new \DateInterval('PT24H'));
|
||||||
|
|
||||||
// Setup routing
|
// Setup app + routing
|
||||||
$application = new \Proton\Application();
|
$application = new \Proton\Application();
|
||||||
$application->post('/access_token', function (Request $request) use ($server) {
|
$application->post('/access_token', function (Request $request) use ($server) {
|
||||||
|
|
||||||
try {
|
try {
|
||||||
return $server->getAccessTokenResponse($request);
|
return $server->getAccessTokenResponse($request);
|
||||||
} catch (OAuthException $e) {
|
} catch (OAuthException $e) {
|
||||||
return $e->generateHttpResponse();
|
return $e->generateHttpResponse();
|
||||||
}
|
}
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
// Run the app
|
// Run the app
|
||||||
|
Loading…
Reference in New Issue
Block a user