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

👋👋👋When trying to login with apple show this error👋👋👋 Client error: POST https://appleid.apple.com/auth/token resulted in a 400 Bad Request response: {"error":"invalid_client","email_verified":false} #53

Open
developeralamin opened this issue Sep 3, 2024 · 3 comments

Comments

@developeralamin
Copy link

developeralamin commented Sep 3, 2024

Client error: POST https://appleid.apple.com/auth/token resulted in a 400 Bad Request response: {"error":"invalid_client","email_verified":false}

JWT token

<?php
require 'vendor/autoload.php';

use Firebase\JWT\JWT;

$teamId = 'xyz';
$clientId = 'xyz';
$keyId = 'xyz';
$authKey = file_get_contents('xyz.p8');

$now = time();
$payload = [
    'iss' => $teamId,         // Issuer (your team ID)
    'iat' => $now,            // Issued at (current time)
    'exp' => $now + 86400 * 180, // Expiration (6 months)
    'aud' => 'https://appleid.apple.com',
    'sub' => $clientId        // Subject (your client ID)
];

$header = [
    'alg' => 'ES256',
    'kid' => $keyId
];

$jwt = JWT::encode($payload, $authKey, 'ES256', $keyId, $header);

echo $jwt;

I recreated my JWT token to make sure it was not expired and I made sure the ES256 algorithm was being used.

Has anyone with this issue found a solution?

@developeralamin developeralamin changed the title When trying to login with apple show this error👋 When trying to login with apple show this error👋 Client error: POST https://appleid.apple.com/auth/token resulted in a 400 Bad Request response: {"error":"invalid_client","email_verified":false} Sep 3, 2024
@developeralamin developeralamin changed the title When trying to login with apple show this error👋 Client error: POST https://appleid.apple.com/auth/token resulted in a 400 Bad Request response: {"error":"invalid_client","email_verified":false} 👋👋👋When trying to login with apple show this error👋👋👋 Client error: POST https://appleid.apple.com/auth/token resulted in a 400 Bad Request response: {"error":"invalid_client","email_verified":false} Sep 3, 2024
@mzrikaz
Copy link

mzrikaz commented Nov 27, 2024

Same issue here, have u got fix for it?

@developeralamin
Copy link
Author

developeralamin commented Nov 27, 2024 via email

@developeralamin
Copy link
Author

Same issue here, have u got fix for it?

https://dev.to/developeralamin/what-is-the-process-to-sign-in-with-apple-with-laravel-34nd

Following this docs.

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

2 participants