Looking for more information on how to do PHP the right way? Check out PHP: The Right Way

SitePoint PHP Blog:
Social Logins in PHP with HybridAuth
Apr 16, 2015 @ 16:54:14

The SitePoint PHP blog has posted a new tutorial showing you how to integrate the HybridAuth library into your application for easy logins via popular social sites like Facebook, Twitter or even Google+.

A trend in many of today’s websites is a feature that allows users to sign in via their social network accounts. A classic example is the SitePoint community where users have the option to use their Facebook, Twitter, Google, Yahoo or GitHub account to log in without having to register an account. In this tutorial, we will be learning about HybridAuth – a PHP library that takes the pain out of building a social login feature. HybridAuth acts as an abstract API between your application and the various social APIs and identity providers.

They jump right into things, showing you how to install the library via Composer and configure it to work with a simple Slim-based application. They set up providers for Facebook, Twitter and Google+ and show how to call the "authenticate" method to make the connection. He then starts on the sample application, creating a login page and a database table for user tracking. The process continues showing how to connect the user from the social site to your setup and retrieve their profile information. All the code you'll need is here, including the Slim structure, the database connection setup and the needed templates. You can also find the finished product in this GitHub repository.

tagged: social login tutorial hybridauth facebook twitter googleplus socialnetwork

Link: http://www.sitepoint.com/social-logins-php-hybridauth/

SitePoint PHP Blog:
Social Network Authentication - Setup & Google+
Jul 15, 2014 @ 16:12:06

The SitePoint PHP blog has posted the first two parts of a "Social Network Authentication" series looking at connecting your application with social network systems. In these first two posts they help you get things set up to connect to the remote systems and create an actual connection to Google+.

Almost every website which contains a log in option, also contains ways to log in through different social networks. In this series of articles, we will take a look at how we can make sure that our visitor can log in through Google+ and eventually other networks like Twitter and Facebook. In the final article, we will have a close look at how we can make sure users don’t have different accounts due to the fact that they used different social networks. We will create a framework agnostic package which can easily handle users from different social networks. In this part, we will have a look at our basic setup.

The first tutorial helps you get things all set up and takes the first steps in making the "SocialLogin" package. In the second tutorial they use this package structure to create a Google+ specific instance, making the OAuth connection as simple as calling a method, loading a URL and handling the response.

tagged: social network authentication tutorial series googleplus

Link: http://www.sitepoint.com/series/using-social-networks-as-a-login-system/

InfoTuts.com:
Create Login With Google Plus in Your Website With PHP
Apr 15, 2014 @ 15:20:31

On the InfoTuts.com site they've posted a tutorial showing you how to make a "Log in with Google" button for your application and make it work with a little PHP magic on the backend.

So you want to allow users to login into your website using their gmail credentials? You have seen various websites that allow their users to login in their websites using gmail, facebook, linked in, Microsoft, git hub credentials. It’s time to integrate it in your website. We will cover all the login system in our posts one by one and this one is dedicated to create Google Plus login for your website with PHP using OAuth2. Google offers many APIs like Google Maps, translate API, Analytics ApI etc. Today we will use its Google Plus API so lets proceed with our tutorial.

They break the process down into about five steps:

  • Login to Google API Console. Go to APIs and you will have to turn on Google Plus API.
  • Go to APIs and Auth and then under credentials tab. Click on create new client ID as shown below.
  • Now when you will have to enter your website path and the file path (redirect URI) to get your new client ID.
  • Now you have to set Consent screen.
  • In consent screen if you have entered Google Plus page path then you will have to approve connection.

The code for the actual connection is in the last step. It uses Google's PHP client libraries to configure and make the request, fetch the access token and grab the Google+ user's data.

tagged: googleplus login oauth2 client library tutorial

Link: http://www.infotuts.com/login-with-google-plus-in-your-website-php

WebSpeaks.in:
Search Google Plus Profiles using PHP and Google Plus API
Jun 01, 2012 @ 14:05:05

In this new tutorial to the WebSpeaks blog, Arvind Bhardwj shows you how to hook up to the Google+ API and search profiles for your desired terms.

The main aim of this application is to go familiar with the Google Plus API usage. Google Plus provides an extremely easy to use API to access the public contents on it. Here we will create a simple search application to search user profiles on Google Plus.

Complete code is provided in the post (PHP) and instructions on setting up an "application" on G+ so you can get the keys needed to connect to the API. You can see it in action in the live demo or just download the source to get started.

tagged: googleplus api search profile demo

Link:

Lorna Mitchell's Blog:
Using OAuth2 for Google APIs with PHP
Mar 29, 2012 @ 17:02:21

Lorna Mitchell has a new post to her blog today showing how to use the functionality provided by the pecl_http extension to make an OAuth2 connection to Google.

I've written about Google and OAuth before, but that was OAuth v1.0, and they are introducing OAuth2 for their newer APIs; in this example I was identifying myself in order to use the Google Plus API. [...] OAuth 2 doesn't need an extension or any particular library as it doesn't have the signing component that OAuth 1 had, and OAuth 2 also has fewer round trips. It does require SSL however, because the requests are in the clear.

She includes some code snippets with an example of a connection - making a request to the remote HTTPS resource, adding some parameters to the URL (including the response type, your client ID and a redirect url). The response then contains the "code" value you'll need to make the second request to fetch the access token you'll need on future requests. You can find out more about the interface she's accessing in these docs about the Google Plus API.

tagged: oauth2 tutorial googleplus token pecl http

Link:

DZone.com:
Practical Google+ Api
Sep 21, 2011 @ 13:27:53

On Dzone.com today Giorgio Sironi has a new post looking at a relatively new release on the social networking scene for developers, the Google+ Api, and some details on how you get get started writing apps using the features it offers.

Google+ recently releases to developers the first version of its Api, which focuses on public data about profiles and their activities: status updates, resharings and links. I dived into the Api and wrote a small sample application to get a feel of how easy is to get started, and what can we do with the Api for now. All the code is at the bottom of this post.

He goes through the steps you'll need to get set up - registering an application, getting a library to help make the connection (here's a PHP one) and configuring it with your credentials. You can get "People" and "Activities" information from the API. He shows some sample output for each - basic user information (nested arrays) and some of his activities (again, nested arrays). He includes the source for his sample application that pulls a user's profile information and lists out their latest (public) activities.

tagged: googleplus api introduction sample library application

Link:


Trending Topics: