Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add issued_at_leeway as a config parameter #231

Closed
wants to merge 1 commit into from
Closed

Add issued_at_leeway as a config parameter #231

wants to merge 1 commit into from

Conversation

ttilberg
Copy link

When receiving the JSON Web Token response back from Google, it includes an Issued At timestamp in unix time. If your clock is behind this timestamp, you will receive JWT::InvalidIatError since by default, it does not allow future tokens.

Adding leeway as a configurable option makes it easy to allow for future tokens with whatever tolerance you are comfortable with in the config.omniauth statement.

Example Usage:

config.omniauth :google_oauth2, ENV['GOOGLE_OAUTH_ID'], ENV['GOOGLE_OAUTH_SECRET'], {
    scope: "email", issued_at_leeway: 300  # Allow 5 minutes into the future
 }

This is in response to #195

When receiving the JSON Web Token response back from Google, it includes an Issued At timestamp in unix time. If your clock is behind this timestamp, you will receive `JWT::InvalidIatError` since by default, it does not allow future tokens.

Adding leeway as a configurable option makes it easy to allow for future tokens with whatever tolerance you are comfortable with in the `config.omniauth` statement.

Usage:
config.omniauth :google_oauth2, ENV['GOOGLE_OAUTH_ID'], ENV['GOOGLE_OAUTH_SECRET'], {
    scope: "email", access_type: "offline", issued_at_leeway: 300
  }
@zquestz
Copy link
Owner

zquestz commented Mar 11, 2016

This was already added. #230

@zquestz
Copy link
Owner

zquestz commented Mar 11, 2016

Really appreciate you giving it a go, but with jwt 1.5.x there were side effects, like ruby 1.9 not working anymore. You can see the other adjustments in my PR.

@ttilberg
Copy link
Author

Cool, thanks for looking into this!

@ttilberg ttilberg closed this Mar 11, 2016
@ttilberg ttilberg deleted the ttilberg-allow-future-iat branch March 11, 2016 23:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants