Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

DPlachkov's avatar

Laravel Passport -exposing REST API grant type to pick

Hello. I've been reading on Laravel Passport quite a lot, since i have to create a RESTful API and expose it to other web applications. Now I've learned that there are 4 types of grants. 2 of them I won't be using as of now (implicit and password) My question is which grant should I actually choose, so other applications can integrate my API

  1. Client Credentials Grant Tokens
  2. OAuth2 with authorization codes.

Reading on this seems to indicate that i should choose type 1. Where another app would have to send a request to /auth/token with client id and secret and get the access token and start accessing the resource server to create items and retrieve them. It seems that if i choose type 2, it would take 2 steps to integrate, meaning the consuming app would have to make a method to send a request for authorization, which would have to be executed in the browser by a person, so he can be redirected to a login page and authorize it(after logging in), and then the access token would be delivered(sent back to the notification callback) and saved(to be regenerated by refresh tokens), which seems to be incorrect way to deal with this in this use case, because this would seem to be designed for a person using a site, to connect to another web service.

0 likes
0 replies

Please or to participate in this conversation.