usdk icon indicating copy to clipboard operation
usdk copied to clipboard

Login redirect versus code case fixes

Open avaer opened this issue 1 year ago • 3 comments

We should split the login flow between redirect and code copy cases.

Currently they are both under the same pipeline, which results in a suboptimal login experience. For example, there is no way to perform a code login without first going through the redirect flow which errors.

Fix 1: change https://login.upstreet.ai/logintool -> https://login.upstreet.ai/ (could be a new app in next.js)

Flow 0: traditional login
  -> user navigates to https://login.upstreet.ai/
  -> login
  -> redirect to https://upstreet.ai/, logged in

Flow 1: automatic callback login
  -> `usdk login` # browser open success (local developer machine)
  -> automatically open https://login.upstreet.ai/?mode=auto&callback_url=https%3A%2F%2Flocal.upstreet.ai%3A10617
  -> user logs in
  -> automatic callback to https://local.upstreet.ai:10617
    -> ok?
      -> login confirmed
    -> error?
      -> error message AND display code for manual login
      -> paste code to CLI
      -> login confirmed

Flow 2: code login
CLI:
  -> `usdk login` # browser open failure (remote server or something)
  -> prompt the user to manually open https://login.upstreet.ai/?mode=code
  -> user logs in
  -> code rendered
  -> copy
  -> paste to CLI
  -> login confirmed

avaer avatar Nov 08 '24 19:11 avaer

Note: Update all redirect URLs after this is merged and test all logins.

mavisakalyan avatar Nov 12 '24 11:11 mavisakalyan

Current reproduction:

https://github.com/user-attachments/assets/06440df6-9e79-48c3-b3df-faafb552e7f3

AbdurrehmanSubhani avatar Nov 12 '24 12:11 AbdurrehmanSubhani

Github CLI's oauth flow code: https://github.com/cli/oauth

AbdurrehmanSubhani avatar Nov 12 '24 14:11 AbdurrehmanSubhani