{"id":13716131,"url":"https://github.com/microauth/microauth-twitter","last_synced_at":"2026-01-12T00:58:55.809Z","repository":{"id":57296538,"uuid":"88049923","full_name":"microauth/microauth-twitter","owner":"microauth","description":"Twitter oauth for micro","archived":false,"fork":false,"pushed_at":"2020-06-03T09:22:22.000Z","size":319,"stargazers_count":39,"open_issues_count":3,"forks_count":3,"subscribers_count":4,"default_branch":"master","last_synced_at":"2024-11-14T04:34:37.020Z","etag":null,"topics":["auth","authentication","javascript","js","micro","microauth","microservice","nodejs","twitter"],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","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/microauth.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2017-04-12T12:35:59.000Z","updated_at":"2023-08-15T16:34:56.000Z","dependencies_parsed_at":"2022-09-07T03:21:26.286Z","dependency_job_id":null,"html_url":"https://github.com/microauth/microauth-twitter","commit_stats":null,"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/microauth%2Fmicroauth-twitter","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/microauth%2Fmicroauth-twitter/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/microauth%2Fmicroauth-twitter/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/microauth%2Fmicroauth-twitter/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/microauth","download_url":"https://codeload.github.com/microauth/microauth-twitter/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":252823140,"owners_count":21809700,"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":["auth","authentication","javascript","js","micro","microauth","microservice","nodejs","twitter"],"created_at":"2024-08-03T00:01:07.379Z","updated_at":"2026-01-12T00:58:55.777Z","avatar_url":"https://github.com/microauth.png","language":"JavaScript","readme":"# microauth-twitter\n\n\u003e Twitter oauth for [micro](https://github.com/zeit/micro/)\n\n[![Build Status](https://travis-ci.org/microauth/microauth-twitter.svg?branch=master)](https://travis-ci.org/microauth/microauth-twitter)\n[![XO code style](https://img.shields.io/badge/code_style-XO-5ed9c7.svg)](https://github.com/sindresorhus/xo)\n[![Greenkeeper badge](https://badges.greenkeeper.io/microauth/microauth-twitter.svg)](https://greenkeeper.io/)\n\nAdd [twitter](https://twitter.com) authentication to your [micro](https://github.com/zeit/micro/) service as easy as a flick of your fingers.\nThis module is a part of [microauth](https://github.com/microauth/microauth) collection.\n\n## Installation\n\n```sh\nnpm install --save microauth-twitter\n# or\nyarn add microauth-twitter\n```\n\n## Usage\n\napp.js\n```js\nconst { send } = require('micro');\nconst microAuthTwitter = require('microauth-twitter');\n\nconst options = {\n  consumerKey: 'CONSUMER_KEY',\n  consumerSecret: 'CONSUMER_SECRET',\n  callbackUrl: 'http://localhost:3000/auth/twitter/callback',\n  path: '/auth/twitter'\n};\n\nconst twitterAuth = microAuthTwitter(options);\n\n// third `auth` argument will provide error or result of authentication\n// so it will { err: errorObject} or { result: {\n//  provider: 'twitter',\n//  accessToken: 'blahblah',\n//  accessTokenSecret: 'blahblah',\n//  info: userInfo\n// }}\nconst handler = async (req, res, auth) =\u003e {\n\n  if (!auth) {\n    return send(res, 404, 'Not Found');\n  }\n\n  if (auth.err) {\n    // Error handler\n    return send(res, 403, 'Forbidden');\n  }\n\n  // save something in database here\n\n  return `Hello ${auth.result.info.screen_name}`;\n\n};\n\nmodule.exports = twitterAuth(handler);\n```\n\nRun:\n```sh\nmicro app.js\n```\n\nNow visit `http://localhost:3000/auth/twitter`\n\n\n## Author\n[Dmitry Pavlovsky](http://palosk.in)\n","funding_links":[],"categories":["Modules","twitter"],"sub_categories":["Authentication"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmicroauth%2Fmicroauth-twitter","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmicroauth%2Fmicroauth-twitter","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmicroauth%2Fmicroauth-twitter/lists"}