Laravel authentication via Passport using "Authorization Code Grant with PKCE" for stateless application

493 Views Asked by At

I am developing stateless API service with authentication by JWT tokens, service must have access token and refresh token, for implementation used official Laravel Passport package.

The Laravel Passport package documentation (Laravel Passport documentation) states that Password Grant Tokens are deprecated: proof

If you go to OAuth 2.0 Server documentation - it will say that Password Grant is really deprecated and it is recommended to use it instead Authorization code grant: proof 1 proof 2

In the documentation for the Authorization code grant Authorization code grant documentation

The documentation for the channel shows two parts of the implementation:

  1. In the first part of the implementation, I have to send a request to get the code and state.

  2. In the second part of the implementation, using the code (which came in the first part), we get tokens.

  3. The first problem is that the documentation in the first part should be redirecting, but since I have a stateless service, I can't use redirects.

  4. The second problem is that the package uses a web provider (StatefulGuard) for this, but since stateless applications it only has an api provider (TokenGuard).

proof

0

There are 0 best solutions below