- Notifications
You must be signed in to change notification settings - Fork0
fullstack-resources/adonis-ally
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
Adonis Ally is a 1st party authentication provider for AdonisJs apps. It gives you the functionality to authenticate users using social websites likeFacebook,Twitter,Google,Github etc 🌲
The setup process is simple like any other provider for AdonisJs.
adonis install @adonisjs/ally
The provider needs to be registered insidestart/app.js
file.
constproviders=['@adonisjs/ally/providers/AllyProvider']
BOOM! Now you are good to make use of the ally provider and authenticate your users via available drivers.
## Available DriversBelow is the list of available drivers and you are free to add more.
- Github
- Foursquare
## Config
Configuration is defined inside a file calledconfig/services.js
underally
object.
ally:{facebook:{clientId:'',clientSecret:'',redirectUri:''}}
## Getting Started
Below is the list of methods you can make use of to redirect the user and fetch their profile details.
Get the redirect url for the 3rd party website.
consturl=awaitally.driver('facebook').getRedirectUrl()
Redirect to the 3rd party website.
awaitally.driver('facebook').redirect()
Get the user details on the redirect URL.
constuser=awaitally.driver('facebook').getUser()
Theuser
is an instance ofAllyUser
which has following methods to access the user details.
user.getId()// user iduser.getName()// get user nameuser.getEmail()// get user email addressuser.getNickname()// get user nick nameuser.getAvatar()// get user profile picture urluser.getAccessToken()// get access tokenuser.getRefreshToken()// get refresh token (only when using OAuth2)user.getExpires()// get access token expiry (only when using OAuth2)user.getTokenSecret()// get token secret (only when using OAuth1)
user.toJSON()// get user JSON representationuser.getOriginal()// get the original response object from 3rd party website
👉Read the Official Documentation
Checkout theofficial documentation at the AdonisJs website for more info.
Tests are written usingjapa. Run the following commands to run tests.
npm run test:local# report coveragenpm runtest# on windowsnpm run test:win
CheckoutCHANGELOG.md file for release history.
AdonisJs –@adonisframework –virk@adonisjs.com
CheckoutLICENSE.txt for license information
Harminder Virk (Aman) -https://github.com/thetutlage
About
AdonisJs social authentication provider
Resources
Contributing
Uh oh!
There was an error while loading.Please reload this page.
Stars
Watchers
Forks
Packages0
Languages
- JavaScript100.0%