Skip to content
This repository was archived by the owner on Jun 23, 2023. It is now read-only.
This repository was archived by the owner on Jun 23, 2023. It is now read-only.

Exception when refreshing a token after grant has expired #202

@melanger

Description

@melanger

When trying to use a refresh token after grant (the session) expires, there is an unclear error: NoneType object has no attribute expires_at

This is because here, the access_token.expires_at property is accessed:

if access_token.expires_at:

where access_token is a result of grant.mint_token, which may return None:

) -> Optional[SessionToken]:

And it returns None whenever the grant/token is not active:

if self.is_active() is False:

Which happens when the grant expires (e.g. I set the grant expiration to 12 hours and I try to use a refresh token on the token endpoint after 13 hours).

This causes an exception, which for example in satosa-oidcop is handled by a general error response "request cannot be processed", which does not say much.

I guess I should set grant expiration to be longer than any token expiration (e.g. refresh token expiration) in the config, but this exception may still be addressed to provide better error message.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions