Closed CodingDoug closed 1 year ago
As an example, here is what the Firebase CLI shows:
Visit this URL on this device to log in:
https://accounts.google.com/o/oauth2/auth?client_id=563584335869-fgrhgmd47bqnekij5i8b5pr03ho849e6.apps.googleusercontent.com&scope=email%20openid%20https%3A%2F%2Fwww.googleapis.com%2Fauth%2Fcloudplatformprojects.readonly%20https%3A%2F%2Fwww.googleapis.com%2Fauth%2Ffirebase%20https%3A%2F%2Fwww.googleapis.com%2Fauth%2Fcloud-platform&response_type=code&state=924318707&redirect_uri=http%3A%2F%2Flocalhost%3A9005
Waiting for authentication...
✔ Success! Logged in as your-email@gmail.com
I can do this one to free up athos. However in my reading of the code, the information about the user doesn't sound too easy to find. We have the jtw but we never decrypt it, we issue a call to test if it is valid.
I'll do the success string without the username / email and @athoscouto can follow up with a slightly better later.
Knowing how to get the username will be handy in the future if someone tries to do turso auth login
with an existing valid token - the CLI can then simply echo back the username that is currently signed in.
There's now an API for this: https://github.com/chiselstrike/iku-turso-api#get-user-information
@penberg that link points to the iku-turso-api root :(
The users
API expects an id, and it is not totally clear to me how to get the id from the existing jwt.
turso db auth
should show something in its output about what it's doing with auth (not just in the browser). For example, if the CLI is waiting for auth in the browser, state that. After signin completes, also show a message to that effect (either success or error).It would also be helpful if the CLI showed the URL that would be loaded into the browser for auth. If the user has multiple browsers installed, they migth not want to use the one that gets launched automatically. Showing the URL would allow them to manually start the auth process.