nov / apple_id

Sign in with Apple backend library in Ruby
https://rubygems.org/gems/apple_id
MIT License
198 stars 23 forks source link

Error when real_user_status is present in Apple's token #11

Closed achernik closed 2 years ago

achernik commented 4 years ago

Hello, I started to see this error in production:

gems/apple_id-1.1.1/lib/apple_id/id_token/real_user_status.rb:24:in `status': no implicit conversion of String into Integer (TypeError)

It happens when Apple's JWT contains real_user_status field.

I've managed to track it down to this line in gem openid_connect: https://github.com/nov/openid_connect/blob/a76c9c84458a0d8c3ec3783ec6c815c285c05d91/lib/openid_connect/response_object/id_token.rb#L19

What happens here is all claims unspecified by OpenID Connect protocol are converted into strings, so a raw attribute value of real_user_status: 0 becomes real_user_status: "0", and blows up with error mentioned.

Is this conversion into strings mandated by OpenID Connect? If yes, I'm happy to provide a PR that undoes it here in apple_id. Alternatively, I could post a PR into openid_connect gem.

What would you prefer?