{"id":20444885,"url":"https://github.com/snapchat/passport-snapchat","last_synced_at":"2025-04-13T00:23:41.934Z","repository":{"id":57320299,"uuid":"159414823","full_name":"Snapchat/passport-snapchat","owner":"Snapchat","description":"Snapchat (OAuth 2.0) authorization strategy for PassportJS","archived":false,"fork":false,"pushed_at":"2023-12-04T23:20:43.000Z","size":309,"stargazers_count":43,"open_issues_count":7,"forks_count":13,"subscribers_count":3,"default_branch":"main","last_synced_at":"2025-03-26T18:21:21.466Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Snapchat.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2018-11-27T23:29:25.000Z","updated_at":"2024-08-23T06:54:03.000Z","dependencies_parsed_at":"2024-06-18T16:53:03.758Z","dependency_job_id":"9f674d39-35a5-42b8-b4a4-0d0c8d3c7632","html_url":"https://github.com/Snapchat/passport-snapchat","commit_stats":{"total_commits":1,"total_committers":1,"mean_commits":1.0,"dds":0.0,"last_synced_commit":"2821b821e43710a6d4560ea72ad8303b0aa653a5"},"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Snapchat%2Fpassport-snapchat","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Snapchat%2Fpassport-snapchat/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Snapchat%2Fpassport-snapchat/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Snapchat%2Fpassport-snapchat/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Snapchat","download_url":"https://codeload.github.com/Snapchat/passport-snapchat/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248648771,"owners_count":21139353,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-15T10:09:36.841Z","updated_at":"2025-04-13T00:23:41.903Z","avatar_url":"https://github.com/Snapchat.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# passport-snapchat\n\n[Passport](http://passportjs.org/) strategy for authenticating with [Snapchat](http://www.snapchat.com/)\nusing the OAuth 2.0 API.\n\nThis module lets you authenticate using Snapchat in your Node.js applications.\nBy plugging into Passport, Snapchat authorization can easily and unobtrusively be integrated\ninto any application or framework that supports\n[Connect](http://www.senchalabs.org/connect/)-style middleware, including\n[Express](http://expressjs.com/).\n\n## Install\n\n    $ npm install passport-snapchat\n\n## [API Reference](https://snapchat.github.io/passport-snapchat/)\n\n## Usage\n\n#### Create an Application\n\nBefore using `passport-snapchat`, you must register an application with\nSnapchat.  If you have not already done so, a new application can be created within the\n[Snap Kit Developer Portal](https://kit.snapchat.com/portal).  Your application will\nbe issued an app ID and app secret, which need to be provided to the strategy.\nYou will also need to configure a redirect URI which matches the route in your\napplication.\n\n#### Configure Strategy\n\nThe Snapchat authorization strategy authenticates users using a Snapchat\naccount and OAuth 2.0 tokens.  The app ID and secret obtained when creating an\napplication are supplied as options when creating the strategy.  The strategy\nalso requires a `verify` callback, which receives the access token and optional\nrefresh token, as well as `profile` which contains the authenticated user's\nSnapchat profile.  The `verify` callback must call `cb` providing a user to\ncomplete authorization.\n\n```js\npassport.use(new SnapchatStrategy({\n    clientID: snapchat_APP_ID,\n    clientSecret: snapchat_APP_SECRET,\n    callbackURL: \"http://localhost:3000/auth/snapchat/callback\"\n  },\n  function(accessToken, refreshToken, profile, cb) {\n    User.findOrCreate({ snapchatId: profile.id }, function (err, user) {\n      return cb(err, user);\n    });\n  }\n));\n```\n\n#### Authenticate Requests\n\nUse `passport.authenticate()`, specifying the `'snapchat'` strategy, to\nauthenticate requests.\n\nFor example, as route middleware in an [Express](http://expressjs.com/)\napplication:\n\n```js\napp.get('/auth/snapchat',\n  passport.authenticate('snapchat'));\n\napp.get('/auth/snapchat/callback',\n  passport.authenticate('snapchat', { failureRedirect: '/login' }),\n  function(req, res) {\n    // Successful authorization, redirect home.\n    res.redirect('/');\n  });\n```\n\n## Examples\n\nDevelopers using the popular [Express](http://expressjs.com/) web framework can\nrefer to an [example](https://github.com/Snapchat/express-4.x-passport-snapchat-example)\nas a starting point for their own web applications.\n\n## FAQ\n\n##### How do I ask a user for additional permissions?\n\nIf you need additional permissions from the user, the permissions can be\nrequested via the `scope` option to `passport.authenticate()`.\n\n```js\napp.get('/auth/snapchat',\n  passport.authenticate('snapchat', { scope: ['user.display_name', 'user.bitmoji.avatar'] }));\n```\n\nRefer to [permissions with Snapchat Login](https://docs.snapchat.com/docs/login-kit/)\nfor further details.\n\n##### How do I obtain a user profile with specific fields?\n\nThe Snapchat profile contains information about a user.  By default,\nNO fields in a profile are returned.  The fields needed by an application\ncan be indicated by setting the `profileFields` option.\n\n```js\nnew SnapchatStrategy({\n  clientID: snapchat_APP_ID,\n  clientSecret: snapchat_APP_SECRET,\n  callbackURL: \"http://localhost:3000/auth/snapchat/callback\",\n  profileFields: ['id', 'displayName', 'bitmoji']\n}), ...)\n```\n\nRefer to the [Login Kit](https://docs.snapchat.com/docs/login-kit)\nsection of the docs for the complete set of available fields.\n\n## Contributing\n\n#### Tests\n\nThe test suite is located in the `test/` directory.  All new features are\nexpected to have corresponding test cases.  Ensure that the complete test suite\npasses by executing:\n\n```bash\n$ npm test\n```\n\n## License\n\n[The MIT License](http://opensource.org/licenses/MIT)\n\nCopyright (c) 2018 Snap Inc.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsnapchat%2Fpassport-snapchat","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsnapchat%2Fpassport-snapchat","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsnapchat%2Fpassport-snapchat/lists"}