C# Class Photon.Chat.AuthenticationValues

Container for user authentication in Photon. Set AuthValues before you connect - all else is handled.
On Photon, user authentication is optional but can be useful in many cases. If you want to FindFriends, a unique ID per user is very practical. There are basically three options for user authentication: None at all, the client sets some UserId or you can use some account web-service to authenticate a user (and set the UserId server-side). Custom Authentication lets you verify end-users by some kind of login or token. It sends those values to Photon which will verify them before granting access or disconnecting the client. The AuthValues are sent in OpAuthenticate when you connect, so they must be set before you connect. If the AuthValues.UserId is null or empty when it's sent to the server, then the Photon Server assigns a UserId! The Photon Cloud Dashboard will let you enable this feature and set important server values for it. https://dashboard.photonengine.com
Show file Open project: Coding4rtist/mind-the-light Class Usage Examples

Public Methods

Method Description
AddAuthParameter ( string key, string value ) : void

Adds a key-value pair to the get-parameters used for Custom Auth.

This method does uri-encoding for you.

AuthenticationValues ( ) : System

Creates empty auth values without any info.

AuthenticationValues ( string userId ) : System

Creates minimal info about the user. If this is authenticated or not, depends on the set AuthType.

SetAuthPostData ( Array byteData ) : void

Sets the data to be passed-on to the auth service via POST.

SetAuthPostData ( string stringData ) : void

Sets the data to be passed-on to the auth service via POST.

ToString ( ) : string

Transform this object into string.

Method Details

AddAuthParameter() public method

Adds a key-value pair to the get-parameters used for Custom Auth.
This method does uri-encoding for you.
public AddAuthParameter ( string key, string value ) : void
key string Key for the value to set.
value string Some value relevant for Custom Authentication.
return void

AuthenticationValues() public method

Creates empty auth values without any info.
public AuthenticationValues ( ) : System
return System

AuthenticationValues() public method

Creates minimal info about the user. If this is authenticated or not, depends on the set AuthType.
public AuthenticationValues ( string userId ) : System
userId string Some UserId to set in Photon.
return System

SetAuthPostData() public method

Sets the data to be passed-on to the auth service via POST.
public SetAuthPostData ( Array byteData ) : void
byteData Array Binary token / auth-data to pass on.
return void

SetAuthPostData() public method

Sets the data to be passed-on to the auth service via POST.
public SetAuthPostData ( string stringData ) : void
stringData string String data to be used in the body of the POST request. Null or empty string will set AuthPostData to null.
return void

ToString() public method

Transform this object into string.
public ToString ( ) : string
return string