Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cc-session-tokens: init #1360

Open
florian-sanders-cc opened this issue Mar 12, 2025 · 0 comments · May be fixed by #1364
Open

cc-session-tokens: init #1360

florian-sanders-cc opened this issue Mar 12, 2025 · 0 comments · May be fixed by #1364
Assignees
Labels
enhancement New feature or request

Comments

@florian-sanders-cc
Copy link
Contributor

florian-sanders-cc commented Mar 12, 2025

Context

The console currently mixes different token types (OAuth & session tokens) in a single view. We need a dedicated component to manage session tokens separately. This component will allow users to view their active session tokens, identify their current session, and provide the ability to revoke individual tokens or all tokens except the current session.

Session tokens represent active login sessions across different devices and browsers. Users need a clear way to monitor these sessions, identify potential security issues (like unauthorized access), and easily revoke access when needed.

To be discussed

  • Should we add additional information like device type, IP address, or location?
  • How should token expiration warnings be calculated?
  • How should the component handle the case when a user revokes their current session token?

Inputs

Attributes/properties

Property Type Default value Mandatory Description
state SessionTokensState { type: 'loading' } true The current state of the session tokens component

Slots

None

CSS custom property

None

CSS part

None

Outputs

Event Data type Description
cc-session-tokens:revoke-token string Fired when user requests to revoke a specific token (token ID)
cc-session-tokens:revoke-all-tokens void Fired when user requests to revoke all tokens except current

Type Definitions

type SessionTokensState = 
  | { type: 'loading' }
  | { type: 'error' }
  | { type: 'loaded', tokens: SessionTokenState[] }
  | { type: 'revoking-all', tokens: SessionTokenState[] };

type SessionTokenState = {
  type: 'current' | 'idle' | 'revoking';
  id: string;
  isCleverTeam: boolean;
  creationDate: Date | string;
  expirationDate: Date | string;
  lastUsedDate: Date | string;
};

type SessionTokenStateWithExpirationWarning = SessionTokenState & {
  isExpirationClose: boolean;
};

Data/APIs

  • GET /v2/self/tokens - Get all session tokens
  • POST /v2/self/tokens/revoke - Revoke a specific session token

Stories & states

  • Loading - Initial loading state while fetching tokens
  • Error - Failed to load tokens
  • Loaded - Successfully loaded session tokens with data
  • Waiting with revoking one token - One token is being revoked
  • Waiting with revoking all tokens - All tokens except current are being revoked
  • Simulations:
    • Loading → Success
    • Loading → Error
    • Revoking token
    • Revoking all tokens

UX writing & i18n

The component will need text for:

  • Main heading ("Session Tokens")
  • Introductory text explaining session tokens
  • Error state message
  • Token information labels (Last used, Creation, Expiration)
  • Current session indicator
  • Expiration warning indicator
  • Clever team indicator
  • Revoke button text
  • Revoke all buttons text
  • Success/error notifications for token revocation

Wireframes and UI propositions

The component will follow these design principles:

  • List of token cards in a responsive layout
  • Special styling for the current session token (always shown first)
  • Each card showing creation date, last used date, and expiration date
  • Visual indicators for:
    • Current session
    • Clever team tokens
    • Tokens approaching expiration
  • Revoke button for each non-current token
  • "Revoke all tokens" button when multiple tokens are present
  • Proper loading and error states following the Clever Cloud design system
  • Responsive layout that adapts to different screen sizes with appropriate breakpoints
@florian-sanders-cc florian-sanders-cc self-assigned this Mar 12, 2025
@florian-sanders-cc florian-sanders-cc added the enhancement New feature or request label Mar 12, 2025
florian-sanders-cc added a commit that referenced this issue Mar 13, 2025
@florian-sanders-cc florian-sanders-cc linked a pull request Mar 13, 2025 that will close this issue
3 tasks
florian-sanders-cc added a commit that referenced this issue Mar 13, 2025
florian-sanders-cc added a commit that referenced this issue Mar 13, 2025
florian-sanders-cc added a commit that referenced this issue Mar 13, 2025
florian-sanders-cc added a commit that referenced this issue Mar 13, 2025
florian-sanders-cc added a commit that referenced this issue Mar 14, 2025
florian-sanders-cc added a commit that referenced this issue Mar 14, 2025
florian-sanders-cc added a commit that referenced this issue Mar 14, 2025
florian-sanders-cc added a commit that referenced this issue Mar 14, 2025
florian-sanders-cc added a commit that referenced this issue Mar 26, 2025
florian-sanders-cc added a commit that referenced this issue Mar 26, 2025
florian-sanders-cc added a commit that referenced this issue Mar 26, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant