whomwah / alfred-github-workflow

An Alfred 5 workflow for working with Github. Uses Deno, written in TypeScript
MIT License
11 stars 1 forks source link

OAuth Flow #6

Open whomwah opened 1 year ago

whomwah commented 1 year ago

This is the flow of the workflow in relation to authentication. If when a user logs in to auth the app and get an oath token it's required they either auth or cancel. If they do neither the webserver continues to run until 30 seconds has parsed where it will stop itself. It would be nice to come up with a more elegant solution.

graph TB
    A(gh...) -->C(We have a saved Github access_token?)
    C -->|Yes| D(All good, start showing results)
    C -->|No| E(Show > login options)
    E --> F(> login)
    E --> G(> login access_token)
    F --> H(Visit Auth screen on Github)
    G --> I(Save access token)
    H --> K(Start Server)
    H --> J(Authorize Workflow)
    K --> L(http://localhost:2820)
    J --> M(Github redirects to a tiny service that handles OAuth handshake and <br>then redirects to http://localhost:2820 with auth token)
    M --> N(Has 30 seconds taken place since authentication page opened?)
    N -->|Yes| Q(Server stopped)
    Q --> R(404 shown and access_token not saved)
    R --> A
    N -->|No| O(Save access_token)
    O --> P(Stop Server)
whomwah commented 1 year ago

[TODO] This needs updating after finding this:

https://www.alfredapp.com/help/workflows/triggers/external/

Which means I no longer need to start my own server to handle the OAuth response and I can just use a url handler to get straight to the workflow.