About
PassportJS auth library integrated into CompoundJS. Why this package needed? To be honest, PassportJS is dead-simple in integrating. But it can be simplier. This package for authentication without extra coding, just configure it and use
Setup project
Put the following configuration in config/passport.yml
.
development: baseURL: 'http://localhost:3000/' local: true google: true github: clientID: "a8578b8dc47834908338" secret: "d8107d7cd75fc8ee1f12cf1f38b3aa065c3ec2ac" linkedin: apiKey: "3s708f1uys4x" secret: "p3iBqlybJ5WNTINv"production: baseURL: 'http://node-js.ru/' github: clientID: "...." secret: "...."
Add module to config/autoload.js
:
module { return ;};
Use
All authentication routes starts with /auth/PROVIDERNAME
Just visit /auth/google
to sign in with google:
<% link_to('Sign in with google', '/auth/google') %>
<% link_to('Sign in with linkedin', '/auth/linkedin') %>
<% link_to('Sign in with github', '/auth/github') %>
Callback urls:
- github:
/auth/github/callback
- linkedin:
/auth/linkedin/callback
Example before filter (describe in your application controller):
;
MIT License
Copyright (C) 2012 by Anatoliy Chakkaev <mail@anatoliy.in> Permission is hereby granted, free of charge, to any person obtaining a copyof this software and associated documentation files (the "Software"), to dealin the Software without restriction, including without limitation the rightsto use, copy, modify, merge, publish, distribute, sublicense, and/or sellcopies of the Software, and to permit persons to whom the Software isfurnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS ORIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THEAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHERLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS INTHE SOFTWARE.