Overview
The Auth Armor API is the central piece of the Auth Armor service. Interfacing with it gives you direct access to all the features Auth Armor provides.
In the below guide, we provide all the ways you interface with it. The initial requirements of it, references and for further uses, the guides for it.
Fundamentals
- The Auth Amour API sits at the URL here: api.autharmor.com
- The Auth Armor API uses Oauth2 Client Credentials flow to authenticate API calls.
API Authentication
- Auth Armor uses OAuth 2.0 standard for its authentication/authorization needs.
What is the OAuth 2.0 standard? ( What is the OAuth 2.0 standard?)
- Obtain your
client_id
andclient_secret
from your project here Auth Armor Project Dashboard
If new, create a project to access these 2 details. How to create a project.
- Request your
bearer token
from our OAuth2 auth Server using these 2 details
POST /connect/token HTTP/1.1
Host: login.autharmor.com
Content-Type: application/x-www-form-urlencoded
Content-Length: [dynmaic]
client_id={your_client_id}&client_secret={your_client_secret}&
grant_type=client_credentials
curl -XPOST -H 'Content-Type: application/x-www-form-urlencoded' -d '{ client_id: "string", client_secret: "string", grant_type: "client_credentials" }' 'https://login.autharmor.com/connect/token'
fetch('https://login.autharmor.com/connect/token', {
method: 'POST',
headers: {
'Content-Type': 'application/x-www-form-urlencoded'
},
body: '{ client_id: "string", client_secret: "string", grant_type: "client_credentials" }'
});
import http.client
conn = http.client.HTTPSConnection("login.autharmor.com")
payload = ""
headers = { 'Content-Type': "application/x-www-form-urlencoded" }
conn.request("POST", "/connect/token", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
package main
import (
"fmt"
"io"
"log"
"net/http"
"strings"
)
func main() {
client := &http.Client{}
var data = strings.NewReader(`{ client_id: "string", client_secret: "string", grant_type: "client_credentials" }`)
req, err := http.NewRequest("POST", "https://login.autharmor.com/connect/token", data)
if err != nil {
log.Fatal(err)
}
req.Header.Set("Content-Type", "application/x-www-form-urlencoded")
resp, err := client.Do(req)
if err != nil {
log.Fatal(err)
}
defer resp.Body.Close()
bodyText, err := io.ReadAll(resp.Body)
if err != nil {
log.Fatal(err)
}
fmt.Printf("%s\n", bodyText)
}
API Authorizations
All requests to protected endpoints require you to pass in your authorization token in your request header for security.
API Perculiars
When using the Auth Armor API, below are the peculiar details you need to know about:
How to hide sensitive identifiers from endpoints:
- When the API Call you are making requires the context of the user. - As a default, you can provide this identifier in the URL of the request you are sending.
- Example Endpoint:
https://docs.autharmor.com/reference/{put_v3-users-user-id}
- Example Endpoint:
- To prevent the exposure of sensitive data, you can provide this information in the Header instead and replace the above path parameter with 00000000-0000-0000-0000-000000000000
- Making the endpoint
https://docs.autharmor.com/reference/00000000-0000-0000-0000-000000000000
- headers: (X-AuthArmor-UsernameValue: [email protected])
- Making the endpoint
- Header data is encrypted data under TLS/SSL mechanism, protecting the exposure of your user’s sensitive data.
API Security
- Request headers are encrypted when using TLS/HTTPS, a request route is not.
- Use
user_id
in the route, if you wish to use a username and it’s not sensitive data. - The above 2 configurations ensure flexibility along with optional tighter security and privacy setup.
With all the information above combined, you can access the direct api reference to make your api calls below or follow our step-by-step guide on implementing Auth Armor as well below.
Updated about 1 year ago