UpstreetAI / upstreet-core

Build and deploy AI Agents, fast.
https://upstreet.ai
6 stars 3 forks source link

Login redirect versus code case fixes #473

Open avaer opened 2 weeks ago

avaer commented 2 weeks ago

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
mavisakalyan commented 2 weeks ago

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

AbdurrehmanSubhani commented 2 weeks ago

Current reproduction:

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

AbdurrehmanSubhani commented 2 weeks ago

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