Skip to content

Token endpoint returning wrong value for expires_in (from refresh token instead of access token) #4191

@pawel-pacewicz-altium

Description

@pawel-pacewicz-altium

Bug description
Authentik endpoint /application/o/token/ seems to be returning the value of a refresh token "expires_in" instead of the access token's.
The application using authentik's SSO capabilities is relying on "expires_at" to refresh the access token proactively. Because information received is incorrect, it won't try to refresh until the token is expired and fail on a request when the access token did expire.

steps to reproduce:
0. (Set-up) Set Access token validity to 6m, refresh token to 14d.

  1. Request new token by querying the URL (can be done from the browser): https://authentik/if/flow/default-provider-authorization-explicit-consent/?response_type=code&client_id=5e6f645d1836e5f696b31fc136a5dde1f734f73f&redirect_uri=_REDIRECT_URI_&scope=SCOPE
  2. Copy the code
  3. Request token through Postman using the code above
  4. Result: "expires_in": 1209600 (e.g. 14d).
    image

Confirmed that the token itself also contains wrong information:
image

Expected behavior
The Access token should return a validity of 360s for validity set to 6m.

Version and Deployment (please complete the following information):

  • authentik version 2022.11.3
  • Deployment: docker

Additional context
This was claimed to be resolved under commit #3306003, but the issue still persists with the latest update of Authentik - confirmed as of Dec 9th, 2022.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingbug/confirmedConfirmed bugs

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions