-
Notifications
You must be signed in to change notification settings - Fork 0
Authentication
In order to connect to the Talaria RTC server, you need to authenticate your client using credentials that consist of client_id and either client_token, auth_token, or quick_call_token. When you sign up for Talaria, we will provide you with client_id and client_token. You can provide credentials for authentication using config or init methods of the sylrtc client.
Although you can use client_token directly in your web page to authenticate, it is best to keep it on your server and use it to obtain temporary auth_token for use in client-side code. That way you are preventing theft of your credentials. The best practice is to use the initial client_token that we have provided you to authenticate on the client-side initially, for simplicity and quick development, and then once you are ready to deploy your solution to production, ask for renewal of client_token and use it only on server-side while using auth_token in your client code. Auth token has 8 hours validity lifetime and after that, it needs to be obtained again.
Quick call tokens (quick_call_token) are used to authenticate people invited to call by your user. Once generated they last for 24 hours and provide your users with the ability to get on the call with somebody outside of your organization very simply, without the need for account creation or password entering by the invited party.
sylrtc.init({
credentials: { // please enter your given id and token
client_id: 'acme',
client_token: '01234567890'
}
});
Or, you can use the configure method:
sylrtc.configure({
credentials: { // please enter your given id and token
client_id: 'acme',
client_token: '01234567890'
}
});
sylrtc.init({
credentials: { // please enter your given id and token
client_id: 'acme',
auth_token: '01234567890'
}
});
Or, you can use the configure method:
sylrtc.configure({
credentials: { // please enter your given id and token
client_id: 'acme',
auth_token: '01234567890'
}
});
sylrtc.init({
credentials: { //
client_id: 'acme',
quick_call_token: '01234567890'
}
});
Or, you can use the configure method:
sylrtc.configure({
credentials: { // please enter your given id and token
client_id: 'acme',
quick_call_token: '01234567890'
}
});
The preferred authentication method is using the auth token that is obtained on your server-side and is passed to the client. That way you are protecting your client_id, and are only exposing temporary auth_token in client-side code. Auth token is valid for 8 hours, and you can obtain it by doing a POST request on our API’s “auth” end-point. Here is JavaScript sample code:
$.post('https://rtc.talaria.solutions/api/auth/', {
client_id: client_id,
client_token: client_token
}, (data, status, xhr) => {
if (data.error) {
console.log(data.error);
} else {
console.log('Your auth token:'+ data.data.auth_token);
}
});
Refreshing of the token happens automatically- when the old one expires, our server will return the refreshed one.
You can obtain it by doing the GET request on our API’s “quick_calling” end-point. Here is JavaScript sample code:
$.get('https://rtc.talaria.solutions/api/quick_calling/', {
client_id: client_id,
client_token: client_token,
username: username,
user_full_name: user_full_name,
avatar: avatar,
invited_person_name: invited_person_name,
room: room
}, (data, status, xhr) => {
if (data.error) {
console.log('error: '+ data.error);
} else {
console.log('here is your quick call token '+ data.data.quick_call_token);
console.log('here is your full quick call link on Talaria rtc server '+ data.data.quick_call_link);
}
});
See more about quick call links here: Quick call links