Revoke Apple Token Api, Always retrun 400

Hello. Whenever I tried to revoke by using an access token from App, I have responsed this error message { "error": "invalid_client" }.

Actually, I can't realize what the problem is. So, Please review my code and check my mistake.

This is the code that generating 'client_secret' code

headers = {
  kid: @apple_key_id,
  alg: "ES256"
}

claims = {
  iss: @apple_team_id,
  iat: Time.now.to_i,
  exp: Time.now.to_i + 86400*180,
  aud: "https://appleid.apple.com",
  sub: "XXXXXXXXXX"
}
private_key = OpenSSL::PKey::EC.new IO.read @apple_key_file_path
apple_client_secret = JWT.encode(claims, private_key, "ES256", headers)

auth/revoke code

url = URI("https://appleid.apple.com/auth/revoke")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url.request_uri)

request.body = {
  "client_id": "XXXXXXXXXX",
  "client_secret": client_secret,
  "token": @token,
  "token_type_hint": "access_token"
}.to_json

request.add_field("Content-Type", 'application/x-www-form-urlencoded')
response = http.request(request)