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

Adding additional parameter #921

Open
LeonardoDB opened this issue Oct 29, 2021 · 1 comment
Open

Adding additional parameter #921

LeonardoDB opened this issue Oct 29, 2021 · 1 comment

Comments

@LeonardoDB
Copy link

LeonardoDB commented Oct 29, 2021

hello,

I can add additional params to authorizationUrl using the library API?

I couldn't add this error=true, I think the lib doesn't allow adding new parameters inside the GenericProvider to be automatically added to url authorizationUrl, for example: https://my-authentication/login?error=true.......

Which option would be better?

@saurabh-ecsion
Copy link

@LeonardoDB You can pass your additional parameters to URL using getAuthorizationUrl() function.

Ex.:

$oauthClient = new \League\OAuth2\Client\Provider\GenericProvider([
            'clientId' => config('azure.appId'),
            'clientSecret' => config('azure.appSecret'),
            'redirectUri' => config('azure.redirectUri'),
            'urlAuthorize' => config('azure.authority') . config('azure.authorizeEndpoint'),
            'urlAccessToken' => config('azure.authority') . config('azure.tokenEndpoint'),
            'urlResourceOwnerDetails' => '',
            'scopes' => config('azure.scopes'),
            'prompt' => 'consent'
        ]);

$authUrl = $oauthClient->getAuthorizationUrl(['prompt' => 'select_account']);

in above code, I am passing 'prompt' parameter to url.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants