Skip to content
New issue

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

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

Already on GitHub? # to your account

Apple provider invalid_client #1305

Open
juggle-ninja opened this issue Dec 3, 2024 · 2 comments
Open

Apple provider invalid_client #1305

juggle-ninja opened this issue Dec 3, 2024 · 2 comments

Comments

@juggle-ninja
Copy link

juggle-ninja commented Dec 3, 2024

When I try to use:
Socialite::driver('apple')->stateless()->user()
inside the callback function, I encounter an error: invalid_client.

The root cause is in the method:
$response = $this->getAccessTokenResponse($this->getCode());
This method makes a Guzzle POST request to the /auth/token endpoint without including the required header 'Content-Type: application/x-www-form-urlencoded'. However, this header is required for the endpoint to process the request correctly.

@xcode-it
Copy link

xcode-it commented Dec 3, 2024

Same issue

Client error: `POST https://appleid.apple.com/auth/token` resulted in a `400 Bad Request` response:

{"error":"invalid_client"}

Also, it should be a GET request but doesn't work with GET request as it shows Method Not allowed

@juggle-ninja
Copy link
Author

@xcode-it , my initial assumption was incorrect. In my case, the issue was related to the use of the firebase/php-jwt package, which was generating an invalid JWT token. After switching to the lcobucci/jwt package, the problem was resolved.

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants