# Authentication

Authentication can be implemented strictly through Discord user connections using [Whop](https://whop.com), a dedicated API, or a combination of both.

With Whop, we can obtain the Discord user's information, including their user ID, key, machine HWID, and access a dedicated dashboard to showcase our product or service.

### Client Settings

To ensure a personalized experience for users, they can store their unique settings in the `settings.json` file, which should be located in the root folder of our software. This file acts as a central repository for storing and accessing user-specific preferences and configurations.

{% code overflow="wrap" %}

```go
package settings

type Settings struct {
	AuthKey        string `json:"key"`
	DiscordWebhook string `json:"webhook"`
	TwoCaptchaKey  string `json:"2captcha_key"`
	AnticaptchaKey string `json:"anticaptcha_key"`
	CapmonsterKey  string `json:"capmonster_key"`
	Solver         string `json:"solver"`
	Delay          Delay  `json:"delay"`
	TaskShoutDown  string `json:"task_shutdown"`
}

type Delay struct {
	Retry   string `json:"retry"`
	Timeout string `json:"timeout"`
}
```

{% endcode %}

### Validate a License Key

This validation involves checking the key against expiration date, activation limits, and machine hwid. Preventing unauthorized usage, and ensure a secure and compliant user experience.

{% code overflow="wrap" %}

```go
func validate_license() {
	licence := loading.Data.Settings.Settings.AuthKey

	url := "https://api.whop.com/api/v2/memberships/<licence>/validate_license"

	req, _ := http.NewRequest("POST", url, nil)

	req.Header.Add("accept", "application/json")
	req.Header.Add("content-type", "application/json")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := os.ReadAll(res.Body)

	fmt.Println(res)
	fmt.Println(string(body))

}
```

{% endcode %}


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://eagle-bot.gitbook.io/eagle-bot/authentication.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
