OrtcSaveAuthentication Method (String, Boolean, String, Boolean, String, Int32, String, DictionaryString, ListChannelPermissions)Open Real Time Connectivity Application Programming Interface Help
Saves the authentication token channels permissions in the ORTC server.

Namespace: Ibt.Ortc.Api
Assembly: Ibt.Ortc.Api (in Ibt.Ortc.Api.dll) Version: 2.1.14.0 (2.1.14)
Syntax

public static bool SaveAuthentication(
	string url,
	bool isCluster,
	string authenticationToken,
	bool authenticationTokenIsPrivate,
	string applicationKey,
	int timeToLive,
	string privateKey,
	Dictionary<string, List<ChannelPermissions>> permissions
)

Parameters

url
Type: SystemString
ORTC server URL.
isCluster
Type: SystemBoolean
Indicates whether the ORTC server is in a cluster.
authenticationToken
Type: SystemString
Authentication Token which is generated by the application server, for instance a unique session ID.
authenticationTokenIsPrivate
Type: SystemBoolean
Indicates whether the authentication token is private (1) or not (0).
applicationKey
Type: SystemString
Application Key that was provided to you together with the ORTC service purchasing.
timeToLive
Type: SystemInt32
The authentication token time to live, in other words, the allowed activity time (in seconds).
privateKey
Type: SystemString
The private key provided to you together with the ORTC service purchasing.
permissions
Type: System.Collections.GenericDictionaryString, ListChannelPermissions
The channels and their permissions (w: write/read or r: read, case sensitive).

Return Value

Type: Boolean
True if the authentication was successful or false if it was not.
Exceptions

ExceptionCondition
OrtcEmptyFieldExceptionServer URL can not be null or empty.
OrtcAuthenticationNotAuthorizedExceptionUnauthorized by the server.
OrtcNotConnectedExceptionUnable to connect to the authentication server.
Examples

// Permissions
Dictionary<string, ChannelPermissions> permissions = new Dictionary<string, List<ChannelPermissions>>();

Dictionary<string, List<ChannelPermissions>> channelPermissions = new Dictionary<string, List<ChannelPermissions>>();
var permissionsList = new List<ChannelPermissions>();

permissionsList.Add(ChannelPermissions.Write);
permissionsList.Add(ChannelPermissions.Presence);

channelPermissions.Add("channel1", permissionsList);

string url = "http://ortc-developers.realtime.co/server/2.1"; 
bool isCluster = true;
string authenticationToken = "myAuthenticationToken";
bool authenticationTokenIsPrivate = true;
string applicationKey = "myApplicationKey";
int timeToLive = 1800; // 30 minutes
string privateKey = "myPrivateKey";

bool authSaved = Ibt.Ortc.Api.Ortc.SaveAuthentication(url, isCluster, authenticationToken, authenticationTokenIsPrivate, applicationKey, timeToLive, privateKey, channelPermissions))
See Also

Reference