xo / usql

Universal command-line interface for SQL databases
MIT License
8.82k stars 346 forks source link

usql with oauth #377

Closed ghost closed 1 year ago

ghost commented 1 year ago

Hi everyone.

idea

I was thinking of adding a web interface to authenticate the database in usql. So would use OAuth from those services to kick-off your local config.

concept

$ usql --postgress --oauth
 - $ pg://user:pass@host/dbname

idea

image

note/license

this idea(ui) is based on Devzstudio/Web3UIKit.

nineinchnick commented 1 year ago

Do you want usql to start a web server? I don't think that's a good idea. Instead, I'd suggest opening a browser whenever needed to complete an OAuth workflow. But I'm not aware of any Go SQL driver that would support it. Can you provide an example driver? Both lib/pq and jacks/pgx that we use for PostgreSQL don't support OAuth (yet).

ghost commented 1 year ago

Hi nineinchnick.

Do you want usql to start a web server? I don't think that's a good idea.

no.

Instead, I'd suggest opening a browser whenever needed to complete an OAuth workflow. B

but... my idea is exactly this... open a browser whenever needed to complete an OAuth workflow.

Can you provide an example driver?

yes! example vgarvardt/go-oauth2-pg

Both lib/pq and jacks/pgx that we use for PostgreSQL don't support OAuth (yet).

thank you for feedback.

nineinchnick commented 1 year ago

Thanks, that's a much better description of the request.

To avoid adding new flags, maybe this could be implemented as a new schema with a wrapped driver, something like postgres+oauth://. @kenshaw WDYT?

kenshaw commented 1 year ago

There's a database that requires oauth? How would that information even propagate from the database driver up to usql? I'm open for any PRs, as always.

ghost commented 1 year ago

Hi everyone - all my questions have been answered, I will close this issue.