Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[13.x] Improve issuing PATs #1780

Merged
merged 5 commits into from
Aug 19, 2024
Merged

Conversation

hafezdivandari
Copy link
Contributor

This PR improves issuing personal access tokens:

  • Reduces number of queries to retrieve the client from the DB from 3 to 1.
  • Removes the necessity of redeclaring client credentials on passport.personal_access_client config property and environment variables for each user provider.
  • Reorganizes personal access grant feature tests.
  • Fully backward compatible and no upgrading steps is needed.
Before After
  1. Create a client using passport:client --personal for each user provider.
  2. Set client credentials on passport.personal_access_token config property for each user provider.
  3. Issue access token using $user->createToken().
    1. Get client credentials for the given user provider from config.
    2. Retrieve the client from DB and validate provider.
    3. Pass client_id, client_secret and user_id to the grant.
    4. Retrieve the client from DB to validate the secret.
    5. Retrieve the client from DB to issue the token.
  1. Create a client using passport:client --personal for each user provider.
  2. Issue access token using $user->createToken().
    1. Pass provider and user_id to the grant.
    2. Retrieve the client from DB for the given provider to issue the token.

@taylorotwell taylorotwell merged commit 8375604 into laravel:13.x Aug 19, 2024
7 checks passed
@hafezdivandari hafezdivandari deleted the 13.x-improve-pat branch August 19, 2024 02:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants