royboy789 / wp-api-social-login

Using WP-API and Hello.js to create seamless login and registration via social channels
GNU General Public License v3.0
40 stars 4 forks source link

WP-API SOCIAL LOGIN

We can do many awesome things with WP-API, when building CodeCavalry we needed a way to get people signed up logged in using social networks. While trying some existing plugins were not happy with the outcome and how the flow worked with our application. We created the start to a social login utilizing WP-API to more seamlessly integrate the login and registration.

This is v2 of our routes and plugin that includes a new table since some social API's don't respond with information you need to check if a user exists or create a user.

Supports GitHub Updater

API SETUP

You will need to go to Settings > Social API to configure the API's you want to use. As of now we are only supporting Facbeook, Twitter, and GitHub.

Do you want us to support more? Go to hellojs and create an issue in this GitHub repo with any supported social network and we will add it in.

USAGE

Creation of 2 endpoints for WP-API each accepts a data object array, make sure you are passing in an object named data:

var data = { user_id: XXXXXXX, user_email: XXXX@YYY.com }

LOGIN ENDPOINT

/social_login - use this to login an existing user, will do a check if user exists and return WP Error if no user found or insufficient data

Data Paramenters

REGISTRATION ENDPOINT

also handles login post register
/social_registration - us this to register and login a new user.

Data Parameneters

SHORTCODE

Shortcode generates a form for your users -
[social_login]

Shortcode Attributes

FULL SHORTCODE EXAMPLE

[social_login nickname="true" nickname_placeholder="Custom Username" first_name="true" first_name_placeholder="First Name" last_name="true" last_name_placeholder="Last Name" submit_prefix="Register with" networks="facebook,twitter" social_action="register" redirect="/new-page"]