mirror of
https://github.com/elyby/oauth2-server.git
synced 2024-11-01 16:33:07 +05:30
51d11f6740
Update auth-server-refresh-token.md
1.1 KiB
Executable File
1.1 KiB
Executable File
layout | title | permalink |
---|---|---|
default | Authorization server with refresh token grant | /authorization-server/refresh-token-grant/ |
Authorization server with refresh token grant
Setup
Wherever you intialise your objects, initialize a new instance of the authorization server and bind the storage interfaces and authorization code grant:
$server = new \League\OAuth2\Server\AuthorizationServer;
$server->setSessionStorage(new Storage\SessionStorage);
$server->setAccessTokenStorage(new Storage\AccessTokenStorage);
$server->setClientStorage(new Storage\ClientStorage);
$server->setScopeStorage(new Storage\ScopeStorage);
$server->setRefreshTokenStorage(new Storage\RefreshTokenStorage);
$refreshTokenGrant = new \League\OAuth2\Server\Grant\RefreshTokenGrant();
$server->addGrantType($refreshTokenGrant);
When the refresh token grant is enabled, a refresh token will automatically be created with access tokens issued requested using the authorization code or resource owner password credentials grants.