omniauth / omniauth_openid_connect

MIT License
170 stars 187 forks source link

Add expires_at, to match OmniAuth auth schema #138

Open nevans opened 1 year ago

nevans commented 1 year ago

OmniAuth's Auth Hash Schema should return an expires_at field as a timestamp, but this gem returns expires_in. For compatibility with omniauth-oauth2 strategies, this gem should also return expires_at.

I'm not sure if the best place to fix it is here or upstream, in Rack::OAuth2::AccessToken. On the one hand, the oauth2 gem handles it in OAuth2::AccessToken. On the other hand, the OmniAuth strategy is the only place we can ensure minimal latency between the server response and expires_at computation. I chose here. 🙂

n.b. I would have assumed that "timestamp" in the schema meant a Time object, but all of the gems that inherit from omniauth-oauth2 return Time#to_i, which is also appropriate.