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 IDdisplayName
the user's display namebitmoji.avatarId
the bitmojiAvatarId for the user on Snapchatbitmoji.avatarUrl
the url for rendering the bitmoji avatar for the user on SnapchatGenerated using TypeDoc
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 anaccessToken
,refreshToken
and service-specificprofile
, and then calls thecb
callback supplying auser
, which should be set tofalse
if the credentials are not valid. If an exception occured,err
should be set.Options:
clientID
your Snapchat application's App IDclientSecret
your Snapchat application's App SecretcallbackURL
URL to which Snapchat will redirect the user after granting authorizationprofileFields
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); }); } ));