Best practice to issue token in laravel passport

Viewed 132

I have a first-party clients, such as a mobile application, as Laravel documentation mentioned, in this case using "password" grant tokens is suitable. Then which type is best practice for issue token: first generating a login route and in corresponding controller call the /oauth/token like this:

$response = Http::asForm()->post('http://passport-app.test/oauth/token', [
    'grant_type' => 'password',
    'client_id' => 'client-id',
    'client_secret' => 'client-secret',
    'username' => 'taylor@laravel.com',
    'password' => 'my-password',
    'scope' => '',
]);

and read the client secret from server side, and clients call the login endpoint to get token,

Or let the client call the http://passport-app.test/oauth/token url directly to get access token with posting client secret and id and other required parameters??

and why?

0 Answers
Related