login flow

This commit is contained in:
Dan Anglin 2024-02-26 10:21:51 +00:00
parent 4a76d7a655
commit bd2e878f6b
Signed by: dananglin
GPG key ID: 0C1D44CFBEE68638

View file

@ -5,7 +5,7 @@
== Overview == Overview
Enbas is a https://docs.gotosocial.org/en/latest/[GoToSocial] client for your terminal written Enbas is a https://docs.gotosocial.org/en/latest/[GoToSocial] (GTS) client for your terminal written
in https://go.dev[Go]. The project is currently a work in progress so breaking changes will be in https://go.dev[Go]. The project is currently a work in progress so breaking changes will be
made and bugs may appear here and there during its early development. made and bugs may appear here and there during its early development.
Enbas has limited functionality at the moment and it is **not** recommended for use Enbas has limited functionality at the moment and it is **not** recommended for use
@ -44,6 +44,7 @@ during compilation. You can visit the https://magefile.org/[Mage website] for in
==== Install with mage ==== Install with mage
You can install Enbas with Mage using the following commands: You can install Enbas with Mage using the following commands:
[source,console] [source,console]
---- ----
git clone https://github.com/dananglin/enbas.git git clone https://github.com/dananglin/enbas.git
@ -141,27 +142,47 @@ Use "enbas [command] --help" for more information about a command.
=== Log into your GoToSocial account === Log into your GoToSocial account
Use the `login` command to log into your GoToSocial account with Enbas. Enbas uses the Oauth2 authentication flow to log into your account on GTS. This process requires your input to give consent to allow Enbas access to your account. The login flow is completed using the following steps:
1. You start by using the `login` command specifying the instance that you want to log into.
+
[source,console]
----
enbas login --instance gotosocial-01.social.example
----
2. The application will register itself and the GTS server will create a new client ID and secret that the app needs for authentication.
3. The application will then generate a link to the consent form for you to access in your browser.
This link will be printed on your terminal screen along with a message explaining that you need to obtain the `out-of-band` token to continue.
If you're on Linux the link will open in a new browser for you to sign into your account.
If you're using a different OS or the browser tab doesn't open, you can manually open the link in a new browser tab.
4. Once you've signed into GTS on your browser, you will be informed that Enbas would like to perform actions on your behalf.
If you're happy with this then click on the `Allow` button.
5. The `out-of-band` token will be printed for you at this point. Copy it and return to your terminal.
5. Paste the token into the prompt and press ENTER.
Enbas will then exchange the token for an access token which will be used to authentication to the GTS server on your behalf.
Enbas will then verify the access token and confirm that you have successfully logged into your account.
[source,console] [source,console]
---- ----
enbas login --instance gotosocial.example.local $ enbas login --instance gotosocial-01.social.example
You'll need to sign into your GoToSocial's consent page in order to generate the out-of-band token to continue with
the application's login process. Your browser may have opened the link to the consent page already. If not, please
copy and paste the link below to your browser:
https://gotosocial-01.social.example/oauth/authorize?client_id=01RHK48N1KH9SFNH2VVZR414BJ&redirect_uri=urn%3Aietf%3Awg%3Aoauth%3A2.0%3Aoob&response_type=code
Once you have the code please copy and paste it below.
Out-of-band token: ZGJKNDA2YWMTNGEYMS0ZZJLJLWJHNDITM2IZYJJLNJM3YJBK
Successfully logged into bobby@gotosocial-01.social.example
---- ----
The login flow uses Oauth2 authentication and requires your interaction to complete the process.
The process uses the following steps:
1. The application will register itself and the GTS server will create a new client ID and secret that it needs for authentication.
2. The application will then generate a link to the consent form for you to access in your browser.
If you're on Linux the link will open in a new browser.
If you're using a different OS or the browser tab doesn't open you can manually open the link in a new browser tab.
- Once you've signed in GTS will ask you to confirm that you want to create an out of band token for Enbas. Once you've clicked accept a token will be printed for you. Copy this token and return to your terminal.
- Paste the token into the prompt and press ENTER. Enbas will then exchange the token for and access token which will be used for authentication on your behalf. Enbas will then verify the access token and confirm that you have successfully logged into your account.
=== View your account information === View your account information
=== View a remote account === View a remote account