GenerateToken() public method

In order to authenticate a user connecting to a OpenTok session, a user must pass an authentication token along with the API key.
public GenerateToken ( string sessionId, object options = null ) : string
sessionId string /// Optional. An object used to define preferences for the token. /// /// - role : "subscriber", "publisher", "moderator" /// - expire_time : DateTime for when the token should expire /// - connection_data : any metadata you want about the connection limited to 1000 characters ///
options object
return string
示例#1
0
        public openTok(string REMOTE_ADDR)
        {
            OpenTok ot = new OpenTok();

            Dictionary<string, object> options = new Dictionary<string, object>();

              options.Add(SessionProperties.P2PPreference, "enabled");

            this.SessionId = ot.CreateSession(REMOTE_ADDR, options);
            this.Token = ot.GenerateToken(this.SessionId);
            this.ApiKey = ConfigurationManager.AppSettings["opentok.key"];
        }