# Getting Started ## Summary In this guide we are going to log into an account on a private GoToSocial server. Follow along to log into your own account. ## Your configuration directory Enbas uses Go's [os.UserConfigDir()](https://pkg.go.dev/os#UserConfigDir) function to calculate the location of your configuration directory. If you've set the `XDG_CONFIG_HOME` environment variable, the configuration directory will be set to `$XDG_CONFIG_HOME/enbas`. If this is not set, then: - on Linux the configuration directory will be set to `$HOME/.config/enbas`. - on Darwin (MacOS) the configuration directory will be set to `$HOME/Library/Application Support/enbas`. - on Windows the configuration directory will be set within the `%AppData%` directory. Alternatively you can use the `--config-dir` global flag to specify your configuration directory. ## Generate your configuration file Run the `init` command to generate your configuration file. ```bash enbas init ``` Use the `--config-dir` flag if you want to generate it in a specific directory ```bash enbas --config-dir config init ``` You should now see a file called `config.json` in your configuration directory. Feel free to edit the file to your preferences (configuration documentation coming soon). For this 'Getting Started' guide you may want to specify your preferred browser in the configuration to allow Enbas to open the link to your instance's authorisation page. If you prefer to open the link manually then you can leave it blank. ## Log into your GoToSocial account Enbas uses the Oauth2 authentication flow to log into your account on GoToSocial. ``` [WARNING] As of writing GoToSocial does not currently support scoped authorization tokens so even if we request read-only tokens, the application will be able to perform any actions within the limitations of your account (including admin actions if you are an admin). You can read more about this https://docs.gotosocial.org/en/latest/api/authentication/[here]. ``` Follow the below steps to log into your account: 1. Run the `login` command specifying the instance that you want to log into. ``` enbas login --instance gts.enbas-demo.private ``` 2. Enbas will send a registration request to your instance and receive a new client ID and secret that it needs for authentication. 3. Enbas will then generate a link to the consent form for you to access in your browser and print it to your terminal screen along with a message explaining that you need to obtain the `out-of-band` token to continue. The link will open in a tab in your preferred browser if you've specified it in your configuration, otherwise you can manually open it yourself. If the browser tab doesn't open for you as expected you can still manually open it yourself. 4. Once you've signed into GoToSocial 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. ![A screenshot of the consent form](../assets/images/consent_form.png "Consent Form") 5. The `out-of-band` token from your instance will be displayed to you in your browser. Copy it and return to your terminal. 6. 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 your instance on your behalf. 7. Enbas will then verify the access token, save the credentials to the `credentials.json` file in your configuration directory, and inform you that you have successfully logged into your account. ``` $ 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 ``` ## View your account information