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

Receive invalid_request while getAccessToken #1035

Open
szkruk opened this issue Jul 29, 2024 · 3 comments
Open

Receive invalid_request while getAccessToken #1035

szkruk opened this issue Jul 29, 2024 · 3 comments

Comments

@szkruk
Copy link

szkruk commented Jul 29, 2024

I'm trying to integrate with the Okta using oauth2-client. When i try to log in, I get error:
invalid_request#0 /var/www/html/app/vendor/league/oauth2-client/src/Provider/AbstractProvider.php(628)

$accessToken = $oauthClient->getAccessToken('authorization_code', [ 'code' => $code, ]);

I assume $code is valid, because it's returned from Okta.

error trace:

invalid_request#0 /var/www/html/app/vendor/league/oauth2-client/src/Provider/AbstractProvider.php(628): League\OAuth2\Client\Provider\GenericProvider->checkResponse(GuzzleHttp\Psr7\Response, Array) #1 /var/www/html/app/vendor/league/oauth2-client/src/Provider/AbstractProvider.php(537): League\OAuth2\Client\Provider\AbstractProvider->getParsedResponse(GuzzleHttp\Psr7\Request) #2 /var/www/html/app/src/Service/Auth/OktaAuthenticator.php(133): League\OAuth2\Client\Provider\AbstractProvider->getAccessToken(League\OAuth2\Client\Grant\AuthorizationCode, Array)

invalid_request#0 /var/www/html/app/vendor/league/oauth2-client/src/Provider/AbstractProvider.php(628)](http://app/vendor/league/oauth2-client/src/Provider/AbstractProvider.php(628)): League\OAuth2\Client\Provider\GenericProvider->checkResponse(GuzzleHttp\Psr7\Response, Array)
#1 /var/www/html/app/vendor/league/oauth2-client/src/Provider/AbstractProvider.php(537): League\OAuth2\Client\Provider\AbstractProvider->getParsedResponse(GuzzleHttp\Psr7\Request)
#2 /var/www/html/app/src/Service/Auth/OktaAuthenticator.php(133): League\OAuth2\Client\Provider\AbstractProvider->getAccessToken(League\OAuth2\Client\Grant\AuthorizationCode, Array)

@plierschpl
Copy link

plierschpl commented Aug 1, 2024

Maybe is your OpenID Provider hosted with https and your OpenID Client with http
This was my fail... the client and the server must be running with HTTPS or all with HTTP without redirects to HTTPS

@Curadise
Copy link

@szkruk did you manage to resolve this issue? I have the same error now...

@szkruk
Copy link
Author

szkruk commented Nov 15, 2024

@Curadise It turned out that It was not problem of my code. I just didnt have access to Okta application and something was changed there without my knowledge

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

No branches or pull requests

3 participants