Authentication
Request
curl --location --request POST 'https://api.butlr.io/api/v2/login' \
--header 'Content-Type: application/json' \
--data-raw '{
"username": "your@email.com",
"password": "your_password"
}'
package main
import (
"fmt"
"strings"
"net/http"
"io/ioutil"
)
func main() {
url := "https://api.butlr.io/api/v2/login"
method := "POST"
payload := strings.NewReader(`{
"username": "your@email.com",
"password": "your_password"
}`)
client := &http.Client {
}
req, err := http.NewRequest(method, url, payload)
if err != nil {
fmt.Println(err)
return
}
req.Header.Add("Content-Type", "application/json")
res, err := client.Do(req)
if err != nil {
fmt.Println(err)
return
}
defer res.Body.Close()
body, err := ioutil.ReadAll(res.Body)
if err != nil {
fmt.Println(err)
return
}
fmt.Println(string(body))
}
import requests
import json
url = "https://api.butlr.io/api/v2/login"
payload = json.dumps({
"username": "your@email.com",
"password": "your_password"
})
headers = {
'Content-Type': 'application/json'
}
response = requests.request("POST", url, headers=headers, data=payload)
print(response.text)
Response
{
"access_token": "your_access_token",
"refresh_token": "your_refresh_token",
"id_token": "your_id_token",
"scope": "your_scopes",
"expires_in": 1000,
"token_type": "Bearer"
}
Request
curl --location --request POST 'https://api.butlr.io/api/v2/clients/login' \
--header 'Content-Type: application/json' \
--data '{
"client_id": "your_client_id",
"client_secret": "your_client_secret",
"audience": "your_token_audience",
"grant_type": "client_credentials"
}'
package main
import (
"fmt"
"strings"
"net/http"
"io/ioutil"
)
func main() {
url := "https://api.butlr.io/api/v2/clients/login"
method := "POST"
payload := strings.NewReader(`{
"client_id": "your_client_id",
"client_secret": "your_client_secret",
"audience": "your_token_audience",
"grant_type": "client_credentials"
}`)
client := &http.Client {
}
req, err := http.NewRequest(method, url, payload)
if err != nil {
fmt.Println(err)
return
}
req.Header.Add("Content-Type", "application/json")
res, err := client.Do(req)
if err != nil {
fmt.Println(err)
return
}
defer res.Body.Close()
body, err := ioutil.ReadAll(res.Body)
if err != nil {
fmt.Println(err)
return
}
fmt.Println(string(body))
}
import requests
import json
url = "https://api.butlr.io/api/v2/clients/login"
payload = json.dumps({
"client_id": "your_client_id",
"client_secret": "your_client_secret",
"audience": "your_token_audience",
"grant_type": "client_credentials"
})
headers = {
'Content-Type': 'application/json'
}
response = requests.request("POST", url, headers=headers, data=payload)
print(response.text)
Response
{
"access_token": "your_access_token",
"scope": "your_scopes",
"expires_in": 1000,
"token_type": "Bearer"
}
Last updated