Options
All
  • Public
  • Public/Protected
  • All
Menu

Strategy constructor.

The Snapchat authentication strategy authenticates requests by delegating to Snapchat using the OAuth 2.0 protocol.

Applications must supply a verify callback which accepts an accessToken, refreshToken and service-specific profile, and then calls the cb callback supplying a user, which should be set to false if the credentials are not valid. If an exception occured, err should be set.

Options:

  • clientID your Snapchat application's App ID
  • clientSecret your Snapchat application's App Secret
  • callbackURL URL to which Snapchat will redirect the user after granting authorization
  • profileFields array of fields to add to query. Valid fields are 'id', 'displayName', 'bitmoji'.
  • scope array of scopes. Valid scopes are 'user.display_name' & 'user.bitmoji.avatar'.

Examples:

  passport.use(new SnapchatStrategy({
      clientID: '123-456-789', // process.env.clientID
      clientSecret: 'shhh-its-a-secret', // process.env.clientSecret
      callbackURL: 'https://www.example.net/auth/Snapchat/callback',
      profileFields: ['id', 'displayName', 'bitmoji'],
      scope: ['user.display_name', 'user.bitmoji.avatar'],
    },
    function(accessToken, refreshToken, profile, cb) {
      User.findOrCreate(..., function (err, user) {
        cb(err, user);
      });
    }
  ));

Hierarchy

  • OAuth2Strategy
    • Strategy

Index

Constructors

constructor

Methods

authenticate

  • authenticate(req: Request, options?: any): void

authorizationParams

  • authorizationParams(options: any): object

parseErrorResponse

  • parseErrorResponse(body: any, status: number): Error | null

tokenParams

  • tokenParams(options: any): object

userProfile

  • userProfile(accessToken: string, done: function): void
  • Retrieve user profile from Snapchat.

    This function constructs a normalized profile, with the following properties:

    • provider always set to snapchat
    • id the user's Snapchat ID
    • displayName the user's display name
    • bitmoji.avatarId the bitmojiAvatarId for the user on Snapchat
    • bitmoji.avatarUrl the url for rendering the bitmoji avatar for the user on Snapchat

    Parameters

    • accessToken: string
    • done: function

    Returns void

Legend

  • Module
  • Object literal
  • Variable
  • Function
  • Function with type parameter
  • Index signature
  • Type alias
  • Enumeration
  • Enumeration member
  • Property
  • Method
  • Interface
  • Interface with type parameter
  • Constructor
  • Property
  • Method
  • Index signature
  • Class
  • Class with type parameter
  • Constructor
  • Property
  • Method
  • Accessor
  • Index signature
  • Inherited constructor
  • Inherited property
  • Inherited method
  • Inherited accessor
  • Protected property
  • Protected method
  • Protected accessor
  • Private property
  • Private method
  • Private accessor
  • Static property
  • Static method

Generated using TypeDoc