Skip to content

How to override AuthCodeGrant? #53007

Answered by mazesec
gssj85 asked this question in Q&A
Oct 1, 2024 · 1 comments · 1 reply
Discussion options

You must be logged in to vote

To override the AuthCodeGrant functionality in Laravel Passport and add custom information like a tenant ID, you can create your own custom grant class that extends the existing AuthCodeGrant. Here’s a step-by-step guide to help you do this.

Step 1: Create Your Custom Grant Class

First, create a new class that extends AuthCodeGrant. You’ll want to customize the respondToAuthorizationRequest method (or any other relevant method) to include your tenant ID.

namespace App\OAuth;

use League\OAuth2\Server\Grant\AuthCodeGrant as BaseAuthCodeGrant;
use League\OAuth2\Server\Repositories\AuthCodeRepositoryInterface;
use League\OAuth2\Server\Repositories\RefreshTokenRepositoryInterface;

class MyCu…

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@gssj85
Comment options

Answer selected by gssj85
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants