Class: AuthService

Defined in: src/service/auth.coffee

Overview

Service to manage authorization and authentication with a HAPI instance.

Instance Method Summary

Constructor Details

- (void) constructor(hapilib)

Create a new AuthService.

Parameters:

  • hapilib (Object) An instance of the hapilib singleton

Instance Method Details

- (void) authenticate(type, data, callback)

Authenticate with a given type and data.

Parameters:

  • type (String) The type of authentication to attempt - "client", "facebook" or "code". See below
  • data (Object/Function) Data to send with the authentication request, or a function which will call back with that data. See below
  • callback (Function) A function to run on completion

- (void) authenticateClient(data, callback)

Authenticate the client application. This type of authentication does not require a logged-in user and will only allow public resources to be accessed.

Parameters:

  • data (Object/Function) Data to send with the request, or a callback. Neither is necessary with this type of authentication
  • callback (Function) A function to run on completion

- (void) authenticateFacebook(data, callback)

Authenticate the user using a Facebook signed request.

Parameters:

  • data (Object) Data to send with the request, or a function which will call back with that data
  • callback (Function) A function to run on completion

Options Hash: (data):

  • signedRequest (String) Required; a Facebook signed request

- (void) authenticateCode(data, callback)

Authenticate the user with a code received from HAPI.

Parameters:

  • data (Object) Data to send with the request, or a function which will call back with that data
  • callback (Function) A function to run on completion

Options Hash: (data):

  • code (Integer) An authorization code received from HAPI

- (void) logout()

Log out. Delegates to hapilib#logout.