Authenticating with username and password
Atlas Go can automatically generate an API authentication token given a username and password. For example:
client := atlas.DefaultClient()
token, err := client.Login("username", "password")
if err != nil {
panic(err)
}
The Login function returns an API token that can be used to sign requests. This function also sets the Token parameter on the Atlas Client, so future requests are signed with this access token.
If you have two-factor authentication enabled, you must manually generate an access token on the Atlas website.
|