Authentication
GLAIR Vision API uses API Key and basic authentication (with username & password) to authenticate requests.
You can obtain API Key, username, and password by contacting us via hi[at]glair.ai or via our representative for your company. In the future, we will release a dashboard to make it easier for you to manage your credentials.
How to authenticate
- Supply the
username
&password
inAuthorization: Basic
header (convertusername:password
intobase64
format). - Supply the API Key using request header
x-api-key
.
Here are some code samples on how to authenticate
POST
/ocr/v1/ktp
1
2
3
4
5
6
7
8
9
10
const basicAuth = 'Basic ' + Buffer.from('USERNAME' + ':' + 'PASSWORD').toString('base64');
const apiKey = 'API_KEY';
fetch({
headers: {
Authorization: basicAuth,
'x-api-key': apiKey,
},
...
});
Do NOT commit your API Key, username, and/or password to your repository!
Using an SDK
If you use one of our official SDKs, you won't have to worry about any of the above. You only need to pass API Key, username, and password. All the boilerplate codes have been taken care of.