Skip to content

Print a CLI warning if user is already authenticated #11004

Closed as not planned
Closed as not planned
@phorcys420

Description

@phorcys420

Currently, the CLI lets you log in as many times as you wish even though you're already logged in.
I think the CLI shouldn't let you do that or at least tell you that you're already logged in as a "warning".

Something like, "your Coder CLI is already authenticated as phorcys @ https://coder.domain.tld".

This occurs to me whenever I go back to use coder on a machine I don't use frequently, I never know if I'm logged in or not.
I think there could also be a coder whoami command letting you know what user you're connected with, on what instance and how long your authentication will be valid.

I would like this because I go between my own instance and the dogfood instance, that feature would be pretty handy.


PS C:\Users\Phorcys> coder login https://coder.domain.tld
Your browser has been opened to visit:

        https://coder.domain.tld/cli-auth

> Paste your token here: [...]
> Welcome to Coder, phorcys! You're authenticated.
PS C:\Users\Phorcys> coder login https://coder.domain.tld
Your browser has been opened to visit:

        https://coder.domain.tld/cli-auth

> Paste your token here: [...]
> Welcome to Coder, phorcys! You're authenticated.

Coder v2.4.0+d19a762


cc: @matifali

Metadata

Metadata

Assignees

No one assigned

    Labels

    cliArea: CLI

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions