msa7 / multi_auth

Standardized multi-provider OAuth authentication
MIT License
111 stars 23 forks source link

Missing JSON attribute: id with Twitter #33

Open jwoertink opened 2 years ago

jwoertink commented 2 years ago

https://github.com/msa7/multi_auth/blob/eccc6261a748494afb90988aad75089502ba9140/src/multi_auth/providers/twitter.cr#L58

If the Twitter provider isn't setup properly, you won't get back a valid user json on this line. Since there's no built-in logging here, the only thin you know is of the missing id attribute.

I had to update the code in lib/ to debug what the error was from the raw_json

{"errors":[{"message":"You currently have Essential access which includes access to Twitter API v2 endpoints only. If you need access to this endpoint, you’ll need to apply for Elevated access via the Developer Portal. You can learn more here: https://developer.twitter.com/en/docs/twitter-api/getting-started/about-twitter-api#v2-access-leve","code":453}]}

Maybe this can just catch the error, and re-raise raw_json?