passport-openapi
OpenAPI authentication strategy for Passport and Node.js.
Getting started
const passport = const OpenApiStrategy = // https://dev.twitter.com/oauth/reference/post/oauth2/tokenconst twitterSpec = securityDefinitions: '3-legged': type: "oauth2" flow: "accessCode" authorizationUrl: 'https://api.twitter.com/oauth/authorize' tokenUrl: 'https://api.twitter.com/oauth2/token' const securityDefinition = twitterSpecsecurityDefinitions'3-legged'passport
Example
- Register a new OAuth application on Github
- Launch demo server
git clone git@github.com:blockenio/passport-openapi.git
cd passport-openapi
GITHUB_CLIENT_ID=xxxxx GITHUB_CLIENT_SECRET=xxxxx node --harmony_default_parameters --harmony_proxies example/server.js
open http://localhost:3000/auth/oauth2+github
more example, see test
Supported
see OpenAPI-Specification/2.0.md at master · OAI/OpenAPI-Specification · GitHub
basic
apiKey + header
,apiKey + query
oauth2 + password
oauth2 + accessCode
Not supported
oauth2 + implicit
oauth2 + application
are not supported now.
see "Application access" Aaron Parecki