简体   繁体   中英

Laravel Passport: Create access token manually

I'm trying to find a way to create an access token manually in Laravel 5.5 using Passport and can't seem to figure it out.

I have 2 applications, one that holds the frontend and one api. The user receives an invitation via mail, and when he accesses the link, i wish to create the auth token and send it back in the response.

Any ideas on how to do this ? Thanks.

Solved it myself. It seems that the HasApiTokens trait that you put on the users model has a method to create a token

$user->createToken($name, $scopes);

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM