Making and receiving a call in the browser is done through a Bandwidth JavaScript library called BWClient. Using the BWClient library you will login for a given user/endpoint (e.g. webuser1 with password abc123 from above). For security reasons, you do not want the password exposed in the JavaScript code running in the browser.
Therefore, you will obtain an authorization token in your App Server and use that token to login.
To create an authorization token, use the following REST API:
POST /v1/users/<user-id>/domains/<domain-id>/endpoints/<endpoint-id>/tokens
returns
Headers:
Location <host>/v1/users/<user-id>/domains/<domain-id>/endpoints/<endpoint-id>/tokens/<token>
201 Created. Token information in a JSON payload.
{
“expires” : 86400,
“token”: “283ha89bva289fajf2093jf”
}
where expires is the duration of the token in seconds and token is the authorization token to be passed to the BWClient JavaScript library.