PricingBlog

Cannot get Session-Cookie via get-cookie function

  • mxi012-1277384492637622334

    π“œπ“ͺ𝔁𝓲

    1 year ago

    I want to implement the following functionality:

    1. Initial Token Check on Login Page Load:
    β€’ When a user accesses the login page, the page should retrieve both the access_token and refresh_token.
    β€’ The access_token should then be verified by sending it to a validation endpoint (via an API call).
    2. Handling Token Validation Response:
    β€’ If the access_token is valid, the user should be automatically redirected to the dashboard.
    β€’ If the access_token is invalid or expired, the page should make a POST request to the login API using the refresh_token to obtain new tokens.
    3. Handling Token Refresh:
    β€’ If the token refresh is successful and new tokens are received, the page should update the stored access_token and refresh_token with the new values and redirect the user to the dashboard.
    β€’ If the token refresh fails, the user should remain on the login page, potentially with an error message indicating the need to log in again.

    Does anyone have suggestions or ideas on how to implement this?