social-auth-js
v1.0.0
Published
Social Authentication library for JavaScript
Downloads
31
Maintainers
Readme
Social Auth JS
Intends to provide reusable components that will allow you to access the login flow for several social platforms, some will work as standalone frontend components, others will need some type of backend support.
Platforms
- Github
- Bitbucket
- Vkontakte
- Live
Install
Using NPM
npm i social-auth-js
or using Yarn
yarn add social-auth-js
Using
import SocialAuthJS from 'social-auth-js'
import axios from 'axios'
const socialAuth = new SocialAuthJS(axios, {
providers: {
facebook: {
clientId: 'YOUR_CLIENT_ID',
redirectUri: 'YOUR_REDIRECT_URL',
},
google: {
clientId: 'YOUR_CLIENT_ID',
redirectUri: 'YOUR_REDIRECT_URL',
},
},
});
socialAuth.authenticate('facebook').then((res) => {
// res will return callback token
// call api to verify token and get user information
// If you are using Laravel, you can easily use https://laravel.com/docs/10.x/socialite for authenticate
});