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

add whoami command #252

Merged
merged 3 commits into from Feb 9, 2021
Merged

add whoami command #252

merged 3 commits into from Feb 9, 2021

Conversation

JakeDawkins
Copy link
Contributor

@JakeDawkins JakeDawkins commented Feb 8, 2021

Using an API key, we get back the name, id, and kind of api key (or an error with suggestion if invalid).

From a first look, we could also expand this to do other things, like list org memberships of a user key or list the permissions of a graph key! I just figured having a simple "is this api key valid" command as a first pass would be helpful!

whoami

This command also works with no profiles at all, using the APOLLO_KEY env var:

image

Copy link
Contributor

@EverlastingBugstopper EverlastingBugstopper left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm!

@lrlna lrlna merged commit b96cebd into main Feb 9, 2021
@lrlna lrlna deleted the jake/whoami branch February 9, 2021 09:59
@lrlna lrlna mentioned this pull request Feb 9, 2021
Copy link
Member

@glasser glasser left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some thoughts on a confusing part of the Studio API.

query WhoAmIQuery {
me {
__typename
name
Copy link
Member

@glasser glasser Feb 9, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think I would not recommend reading this field and displaying it to the user as "name". This isn't well documented (our schema isn't too documented, sorry) but this interface field has two real implementations: Service.name and User.name.

Service.name is actually a deprecated field: the value in it is referred to as "title" these days in our UI and has a non-deprecated Service.title field. (We thought it was confusing to have the name and ID be distinct things — people generally referred to the the ID as the name. So we changed it so the things are "title" and "ID", and often use name to mean the latter. So Rover shouldn't use name to mean the former.)

User.name is literally just User.id without the first few characters (gh. etc).

I would recommend not querying Identity.name or displaying a Name: line, but instead doing a ... on Service { title } and showing that field as "title" for graphs specifically. See next comment for more on the User case.

me {
__typename
name
id
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

While I think it's reasonable to display IDs for debugging, I'll note that we don't actually show the user ID to users on the Studio UI. For first-party users, this is just fp.UUID, and as of recently new GitHub users are also gh.UUID (and for older GitHub users, the ID might not actually match their username if they've changed it on GitHub). So while it's probably reasonable to display the ID, it would be very valuable to also show ... on User { email githubUsername }.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants