Refresh token grant - RTLer/laravel-oauth2-server GitHub Wiki

refresh token grant can be used to refresh access token when it expires, it can be activated by adding 'refresh_token' into grants array, like so:

<?php
namespace App\Http\Controllers;

use Psr\Http\Message\ResponseInterface;
use Psr\Http\Message\ServerRequestInterface;
use RTLer\Oauth2\Facade\Oauth2Server;

class OAuthController extends Controller
{

    public function postAccessToken(ServerRequestInterface $request, ResponseInterface $response)
    {
        // ['refresh_token'] active refresh token grant
        $response = Oauth2Server::makeAuthorizationServer(['password', 'refresh_token'])
            ->respondToAccessTokenRequest($request, $response);
        return $response;
    }
}

see Flow for usage info