QuizzesRefresh Tokens, Expiry and Logout — Concept Check
intermediate
full-stack

Refresh Tokens, Expiry and Logout — Concept Check

Questions on Refresh Tokens, Expiry and Logout. Short access tokens buy back revocation, at the cost of a refresh flow that has to handle concurrent requests, rotation and theft detection.

8 minutes 8 questions Pass at 70%
Time Limit
8 minutes - timer starts when you begin
Change Answers Freely
Revisit and change any answer before submitting
Full Review After Submit
Correct answers and explanations shown for every question
Auto-submit on timeout
Quiz submits automatically when time runs out

Questions in this quiz

8 questions on Refresh Tokens, Expiry and Logout — Concept Check. Work through them here, then start the quiz to answer them and see your score.

  1. 1.A user reports being logged out after attempting to refresh their access token multiple times. What is the most likely cause?

    • AThe refresh token was reused, indicating possible theft.
    • BThe refresh token was stored in an insecure location.
    • CThe access token expired and was not renewed.
    • DThe access token was revoked due to inactivity.
  2. 2.During a high load, multiple parallel requests receive a 401 response. What should the system do to handle this efficiently?

    • AInitiate a refresh for each request immediately.
    • BLog out all users to reset the session.
    • CIgnore the 401 responses and retry the requests.
    • DQueue refresh requests to avoid endpoint stampede.
  3. 3.A developer stores refresh tokens directly in the database without hashing. What risk does this pose?

    • AIt allows unauthorized access if the database is leaked.
    • BIt makes the refresh token expire faster.
    • CIt causes the refresh token to be invalidated immediately.
    • DIt prevents the refresh token from being reused.
  4. 4.What happens if a refresh token is reused after it has already been rotated?

    • AThe refresh token is extended for another 30 days.
    • BThe access token is renewed without any issue.
    • CThe user is logged out of all devices immediately.
    • DThe session is invalidated to prevent potential theft.
  5. 5.Why is it important to store refresh tokens as httpOnly cookies with path scoping?

    • ATo ensure they are accessible to JavaScript for client-side processing.
    • BTo allow refresh tokens to be shared across different domains.
    • CTo make refresh tokens available for all types of HTTP requests.
    • DTo reduce exposure and prevent them from being sent with ordinary API calls.
  6. 6.A user changes their password and expects to be logged out from all devices. What mechanism ensures this?

    • AOnly clear the access token from memory.
    • BExtend the expiration of the current access token.
    • CRevoke every refresh token row for the user.
    • DReuse the existing refresh token for new sessions.
  7. 7.What is the primary purpose of refresh token rotation?

    • ATo simplify the process of generating new access tokens.
    • BTo detect token theft by identifying reuse of old tokens.
    • CTo extend the lifespan of the refresh token indefinitely.
    • DTo allow multiple devices to use the same refresh token.
  8. 8.A developer believes that storing refresh tokens in local storage is secure. Why is this incorrect?

    • ALocal storage automatically encrypts the tokens, making them unreadable.
    • BLocal storage is accessible to JavaScript, increasing the risk of XSS attacks.
    • CLocal storage is shared across all browser tabs, causing token conflicts.
    • DLocal storage prevents tokens from being sent with HTTP requests.