Extend JWT expiry time


JWT token is expiring too quickly and is impossible to authenticate after the JWT expiration. Is there any configuration option, or any method to increase to a longer default expiry duration?


1 Like

Hi @rinshad55!

I assume you mean the JWT used by ?

If so, it looks like one of those configuration settings is called valid_within which defaults to 3600 (1 hour). Have you tried expanding that?

gitlab_rails['omniauth_providers'] = [
  { name: 'jwt',
    args: {
      secret: 'YOUR_APP_SECRET',
      algorithm: 'HS256', # Supported algorithms: 'RS256', 'RS384', 'RS512', 'ES256', 'ES384', 'ES512', 'HS256', 'HS384', 'HS512'
      uid_claim: 'email',
      required_claims: ['name', 'email'],
      info_maps: { name: 'name', email: 'email' },
      auth_url: 'https://example.com/',
      valid_within: 3600 # 1 hour