Photon Unity Networking: ExitGames.Client.Photon.Chat.AuthenticationValues Class Reference

Photon Unity Networking

ExitGames.Client.Photon.Chat.AuthenticationValues Class Reference

Container for user authentication in Photon. Set AuthValues before you connect - all else is handled. More...

Public Member Functions

 AuthenticationValues ()
 Creates empty auth values without any info. More...
 
 AuthenticationValues (string userId)
 Creates minimal info about the user. If this is authenticated or not, depends on the set AuthType. More...
 
virtual void SetAuthPostData (string stringData)
 Sets the data to be passed-on to the auth service via POST. More...
 
virtual void SetAuthPostData (byte[] byteData)
 Sets the data to be passed-on to the auth service via POST. More...
 
virtual void AddAuthParameter (string key, string value)
 Adds a key-value pair to the get-parameters used for Custom Auth. More...
 
override string ToString ()
 

Properties

CustomAuthenticationType AuthType [get, set]
 The type of custom authentication provider that should be used. Currently only "Custom" or "None" (turns this off). More...
 
string AuthGetParameters [get, set]
 This string must contain any (http get) parameters expected by the used authentication service. By default, username and token. More...
 
object AuthPostData [get, set]
 Data to be passed-on to the auth service via POST. Default: null (not sent). Either string or byte[] (see setters). More...
 
string Token [get, set]
 After initial authentication, Photon provides a token for this client / user, which is subsequently used as (cached) validation. More...
 
string UserId [get, set]
 The UserId should be a unique identifier per user. This is for finding friends, etc.. More...
 

Detailed Description

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 authentification: 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 Photon Cloud Dashboard will let you enable this feature and set important server values for it. https://www.photonengine.com/dashboard

Constructor & Destructor Documentation

ExitGames.Client.Photon.Chat.AuthenticationValues.AuthenticationValues ( )

Creates empty auth values without any info.

ExitGames.Client.Photon.Chat.AuthenticationValues.AuthenticationValues ( string  userId)

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

Parameters
userIdSome UserId to set in Photon.

Member Function Documentation

virtual void ExitGames.Client.Photon.Chat.AuthenticationValues.AddAuthParameter ( string  key,
string  value 
)
virtual

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

This method does uri-encoding for you.

Parameters
keyKey for the value to set.
valueSome value relevant for Custom Authentication.
virtual void ExitGames.Client.Photon.Chat.AuthenticationValues.SetAuthPostData ( string  stringData)
virtual

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

Parameters
stringDataString data to be used in the body of the POST request. Null or empty string will set AuthPostData to null.
virtual void ExitGames.Client.Photon.Chat.AuthenticationValues.SetAuthPostData ( byte[]  byteData)
virtual

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

Parameters
byteDataBinary token / auth-data to pass on.
override string ExitGames.Client.Photon.Chat.AuthenticationValues.ToString ( )

Property Documentation

string ExitGames.Client.Photon.Chat.AuthenticationValues.AuthGetParameters
getset

This string must contain any (http get) parameters expected by the used authentication service. By default, username and token.

Standard http get parameters are used here and passed on to the service that's defined in the server (Photon Cloud Dashboard).

object ExitGames.Client.Photon.Chat.AuthenticationValues.AuthPostData
getset

Data to be passed-on to the auth service via POST. Default: null (not sent). Either string or byte[] (see setters).

CustomAuthenticationType ExitGames.Client.Photon.Chat.AuthenticationValues.AuthType
getset

The type of custom authentication provider that should be used. Currently only "Custom" or "None" (turns this off).

string ExitGames.Client.Photon.Chat.AuthenticationValues.Token
getset

After initial authentication, Photon provides a token for this client / user, which is subsequently used as (cached) validation.

string ExitGames.Client.Photon.Chat.AuthenticationValues.UserId
getset

The UserId should be a unique identifier per user. This is for finding friends, etc..

Online Documentation  -  Dashboard  -  Support Forum Exit Games GmbH