Authentication Endpoint
Complete instruction for the Visual and API Collections Authentication Option
The Auth Endpoint is configured as a callback to your API. After a user is authenticated by your application and the Verb javascript is rendered and token information is supplied, this is the endpoint Verb will call to verify the user’s legitimate and retrieve any user-specific data used for data filtering.
You can configure the auth endpoint’s properties with parameters passed in from the javascript:
Http Method
The method Verb will use to call the endpoint.
i.e. GET, POST, PUT, etc.
Endpoint
The URL Verb will call on every authentication attempt.
i.e. https://www.myapp.com/api/user, https://{{subdomain}}.myapp.com/auth?uid={{userID}}
Headers
Any headers required by the auth endpoint.
i.e. “Authentication Bearer {{bearerToken}}”
Body
The body to be sent with the request (for POST, PUT, etc HTTP methods).
This can be formatted as raw JSON/XML or as Form Data (optionally URL encoded).
Example 1 - GET with Bearer token passed in header
HTTP Method
GET
Endpoint
http://www.myapp.com/api/user
Headers
Authentication: Bearer {{bearerToken}}
Accept: application/json
Embedding Code
<script>
window.verbAsyncInit = function() {
Verb.init({
apiKey : "REPLACE_WITH_API_KEY",
version : "v1.0",
authParams :
{
"bearerToken": "eyJraWQiOiJNt...aHBwVDdsZyI6IlJ"
},
});
};
</script>
Response
{
"userID": "4a4ab95d-3bf4-4766-a6a6-f94b00d36d3c",
"role": "Manager",
"organizationID": "3c9977fb-b58c-4281-a9c7-fe58eb2c95ff"
}
Example 2 - POST with dynamic URL, Bearer & API key passed in header, JSON body
HTTP Method
POST
Endpoint
http://{{subdomain}}.myapp.com/api/user
Headers
Authentication: Bearer {{bearerToken}}
X-Api-Key: 99ffddee-5f12-4b2d-bf35-a75bf9160715
Content-Type: application/json
Accept: application/json
Body
{
"userID": "{{userID}}"
}
Embedding Code
<script>
window.verbAsyncInit = function() {
Verb.init({
apiKey : "REPLACE_WITH_API_KEY",
version : "v1.0",
authParams :
{
"bearerToken": "eyJraWQiOiJNt...aHBwVDdsZyI6IlJ",
"subdomain": "client-x",
"userID": "c8d23505-dee1-4eef-b03a-989282e924e1"
},
});
};
</script>
Response
{
"userID": "4a4ab95d-3bf4-4766-a6a6-f94b00d36d3c",
"role": "Manager",
"organizationID": "3c9977fb-b58c-4281-a9c7-fe58eb2c95ff"
}
Last updated