Skip to content

Conversation

@braaar
Copy link

@braaar braaar commented Oct 1, 2025

Clarify the current behaviour of the exp parameter in the input JWT. After some tinkering I have concluded that this is the current behaviour.

I could submit this as a bug issue, but I don't know if the auth server itself has a public repository.

If I set exp to anything more than 180 seconds I get a 400 error, even if the client allows for longer lived tokens.

Clarified the current behavior of the exp parameter in the input JWT.
| scope | A list of scopes the access_token is bound to. |
| token_type | Type of token. Only bearer supported. | `Bearer`|
| exp | Expire - Timestamp when this token should not be trusted any more. |
| exp | Expire - Timestamp when this token should not be trusted any more. **Note: This is not respected by the auth server. The configured expiration time on the client decides the expiration of the token.** |
Copy link

@simenandre simenandre Oct 1, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe say something like maximum value is 7200, regardless of what is configured in auth server?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Indeed!

Copy link
Author

@braaar braaar Oct 1, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maximum value of this parameter 180 seconds. Anything more than that and you will get a 400 error.

The actual maximum value that you get from the server is 7200 seconds. It is decided in the client configuration.

It is difficult to explain this odd behaviour in a way that makes sense.

@braaar braaar changed the title docs: clarify expiration behaviour in /token endpoint docs: clarify expiration behaviour in Maskinporten /token endpoint Oct 2, 2025
@joergenb
Copy link
Contributor

@braaar I'm afraid I don't fully understand this PR.
You talk about exp in "the input JWT", which I interpret to be the JWT you construct and send to the /token-endpoint.

This is called a JWT grant, and that one is documented on a different page: https://docs.digdir.no/docs/Maskinporten/maskinporten_protocol_jwtgrant.html
and here the time limitations are already explained: "NOTE: Maximum 120 seconds allowed. (exp - iat <= 120 )"

There is to my knowledge no explicit or implicit standardized relation between the allowable lifetime of a request and the lifetime of the respons (token). In fact, https://datatracker.ietf.org/doc/html/rfc7523#section-3 says "Note that the authorization server may reject JWTs with an "exp" claim value that is unreasonably far in the future. Which is what we do.

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.

3 participants