Skip to content

Customizing Token Expiration

Nikita Bulai edited this page Nov 24, 2016 · 2 revisions

Access Token

By default, all Access Tokens expires in 2 hours (7200 seconds). You can change this in the configuration:

GrapeOAuth2.configure do |config|
  config.access_token_lifetime = 7200 # in seconds
end

If you set the option to nil the Access Token will never expire!

Authorization Code

By default, Authorization Code expires in 30 minutes (1800 seconds). You can change this setting in the configuration:

GrapeOAuth2.configure do |config|
  config.authorization_code_lifetime = 7200 # in seconds
end

Refresh Token

Unlike authorization codes and access tokens, refresh tokens do not have a TTL expiration.