Here's how you can add the Google or Facebook login to your website.
You'll need a developer account with Google and another with Facebook.
We'll show you how to set those up in a different lesson.
For now we'll go over the code you'll need for your webpages.
|
View
|
Step 1. start.html
This is the starting point for your users. They can select to either use
their Google account or Facebook account to log into your website. Here's the code for that webpage.
|
View
|
Step 2. oAuth_google.html
Here's the code for the Google oAuth system. All you'll need is insert your Google credentials in one place.
|
View
|
Step 3. oAuth_facebook.html
Here's the code for the Facebook oAuth system. All you'll need is insert your Facebook credentials in one place.
|
View
|
Step 4. index.html
Success! Your user has successfully logged into your website with their Google or Facebook accounts.
Their data like email, first_name, last_name & Id has been passed to this webpage in the HTTP HEADER.
You can easily extract this data and save it into your database.
|
View
|
Google image
|
View
|
Facebook image
|