ruby – How to sign in with an Apple ID in PHP, to avoid "Invalid Client" error-ThrowExceptions

Exception or error:

Here are my parameters:


The OAuth page says:

'Error getting an access token:' with description: 'Invalid Client'.

My code is:

require 'jwt'

key_file = 'key.p8'
ecdsa_key = key_file

headers = {
    'kid' => 'key id'

claims = {
    'iss' => 'team id',
    'iat' =>,
    'exp' => + (86400*180),
    'aud' => '',
    'sub' => 'client_id,

token = JWT.encode claims, ecdsa_key, 'ES256', headers

puts token

I wonder if there are parameters in the Ruby file that do not generate the token properly or that do not include this error on another page?

How to solve:

Leave a Reply

Your email address will not be published. Required fields are marked *