Class: OauthAuthMethods

Defined in: src/methods/oauth-auth-methods.coffee

Overview

Provides methods to interact with the auth store.

Instance Method Summary

Constructor Details

- (void) constructor(models)

Initializes a new instance of the @see AuthMethods class.

Parameters:

  • models (Object) A collection of models to be used within the auth framework.

Instance Method Details

- (void) currentDateAndSeconds(seconds = TENYEARSINSECONDS) (bound)

Returns the current date + seconds

Parameters:

  • seconds (Number) The seconds, or if null then roughly 10 years is assumed.

- (void) appForClientId(clientId, cb) (bound)

Retrieves an app for a key. This ONLY retrieves active keys

Parameters:

  • appKey (string) the application key to retrieve the app for.

- (void) validate(token, clientId, cb) (bound)

Somehow validates a token. A valid token exists, has not been revoked yet, has an expiration higher than now. isClientValid can be checked for tighter security.

- (void) createAccessGrant(appId, userId, redirectUrl, scope, realm = null, cb) (bound)

Creates a new access grant.

Parameters:

  • appId (String || ObjectId) the mongoose app id.
  • userId (String || ObjectId) the mongoose user id
  • redirectUrl (String) the requested redirect_uri. This must be later matched when issuing an access token.
  • scope (String[]) an array of strings, with one or more elements, specifying the scope that should be granted.
  • realm (String) an optional realm for which this access grant is for.
  • cb (Callback) the callback that will be invoked, with err and the mongoose AccessGrant model.

- (void) createOrReuseTokenForUserId(userId, clientId, realm, scope, expiresIn, cb) (bound)

Creates a token for a user/app/realm

- (void) createTokenForUserId(userId, clientId, realm = null, scope = null, expiresIn = null, cb) (bound)

Creates a token for a user/app/realm

- (void) exchangeAuthorizationCodeForAccessToken(code, cb) (bound)

Takes a code and exchanges it for an access token

Parameters:

  • code (String) the authorization_code to exchange into an access token

- (void) exchangeRefreshTokenForAccessToken(refreshToken, cb) (bound)

Takes a code and exchanges it for an access token

Parameters:

  • refreshToken (String) the refresh_token to exchange into an access token