C# Class Q42.HueApi.RemoteAuthenticationClient

Inheritance: IRemoteAuthenticationClient
Datei anzeigen Open project: Q42/Q42.HueApi

Public Methods

Method Description
BuildAuthorizeUri ( string state, string deviceId, string deviceName = null, string responseType = "code" ) : Uri

Authorization request

GetToken ( string code ) : Task

Get an access token

GetValidToken ( ) : Task

Refreshes the token if needed

ProcessAuthorizeResponse ( string responseData ) : RemoteAuthorizeResponse
RefreshToken ( string refreshToken ) : Task
RemoteAuthenticationClient ( string clientId, string clientSecret, string appId ) : JeffWilcox.Utilities.Silverlight

Private Methods

Method Description
CalculateHash ( string clientId, string clientSecret, string nonce, string path ) : string

Calculate hash for token request

GetNonce ( string r ) : string

Method Details

BuildAuthorizeUri() public method

Authorization request
public BuildAuthorizeUri ( string state, string deviceId, string deviceName = null, string responseType = "code" ) : Uri
state string Provides any state that might be useful to your application upon receipt of the response. The Hue Authorization Server roundtrips this parameter, so your application receives the same value it sent. To mitigate against cross-site request forgery (CSRF), it is strongly recommended to include an anti-forgery token in the state, and confirm it in the response. One good choice for a state token is a string of 30 or so characters constructed using a high-quality random-number generator.
deviceId string The device identifier must be a unique identifier for the app or device accessing the Hue Remote API.
deviceName string The device name should be the name of the app or device accessing the remote API. The devicename is used in the user's "My Apps" overview in the Hue Account (visualized as: " on "). If not present, deviceid is also used for devicename. The is the application name you provided to us the moment you requested access to the remote API.
responseType string The response_type value must be "code".
return System.Uri

GetToken() public method

Get an access token
public GetToken ( string code ) : Task
code string Code retreived using ProcessAuthorizeResponse
return Task

GetValidToken() public method

Refreshes the token if needed
public GetValidToken ( ) : Task
return Task

ProcessAuthorizeResponse() public method

public ProcessAuthorizeResponse ( string responseData ) : RemoteAuthorizeResponse
responseData string
return Q42.HueApi.Models.RemoteAuthorizeResponse

RefreshToken() public method

public RefreshToken ( string refreshToken ) : Task
refreshToken string
return Task

RemoteAuthenticationClient() public method

public RemoteAuthenticationClient ( string clientId, string clientSecret, string appId ) : JeffWilcox.Utilities.Silverlight
clientId string Identifies the client that is making the request. The value passed in this parameter must exactly match the value you receive from hue. Note that the underscore is not used in the clientid name of this parameter.
clientSecret string The clientsecret you have received from Hue when registering for the Hue Remote API.
appId string Identifies the app that is making the request. The value passed in this parameter must exactly match the value you receive from hue.
return JeffWilcox.Utilities.Silverlight