Skip to content

Guidance Needed on Configuring Token Lifetimes in OpenIddict 5.7.0 #2399

@jimiscott

Description

@jimiscott

Confirm you've already contributed to this project or that you sponsor it

  • I confirm I'm a sponsor or a contributor

Version

5.7.0

Question

Hi Kevin,

I hope you’re well. I’m currently working with OpenIddict 5.7.0.

My main problem is this:

When the login page stays idle for around 15 minutes before the user even attempts to sign in, the system immediately returns the error:

Note

error: invalid_token
error_description: The specified token is no longer valid.

What is happening

  1. The login page loads successfully with a long authorization URL containing client_id, scope, code_challenge, nonce, and state.
Image
  1. If I wait (e.g., 15 minutes or more) and then entering credentials, getting response in browser as:
Image

EF Core queries OpenIddictTokens table using ReferenceId.

Image

The failure seems related to the OpenIddict state token or nonce expiring too early during the authorization flow.

I have added options.SetAuthorizationCodeLifetime(TimeSpan.FromMinutes(30)); to see if there is any change, but no.

Below option is also not possible:

Image

Could you please advise:

  • How can we configure or extend the lifetime of the state and nonce tokens in OpenIddict 5.7.0?
  • Are these lifetimes intentionally fixed?
  • If they are not configurable, is there a recommended way to override or adjust the behaviour?
  • Or is there any other way to fix above issue?

I appreciate your time and any guidance you can provide.

Kind regards

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions