Search code examples
laravelpassport-jwt

Laravel passport create token and refresh token


I'm using Laravel and passport on my project. In my project users can get token in two way. First with username and password that its OK by passport. Second with verification code that sent with SMS that its my problem.

I tried createToken() method but it will make a personal token without refresh token and I need to create token with refresh token and specify client id in a controller (without HTTP request).

$user = App\User::find(1);
// Creating a token without scopes...
$token = $user->createToken('Token Name')->accessToken;

How can I do this?


Solution

  • I found a package and I'm using that https://github.com/qiutuleng/laravel-passport-phone-verification-code-grant

    It's good.