DOCUMENTATION.

1.2
MENU

Social Authentication

Quickstart

Social Authentication allows the users of your website to log in with their Facebook, Google+, Twitter, LinkedIn Microsoft, Instagram, GitHub, Yammer, Foursquare, SoundCloud and VK accounts.

To enable them first open app/config/auth.php and add them to the providers array like this:

'providers' => array(
    'facebook' => 'Facebook', 
    'google'   => 'Google', 
    'twitter'  => 'Twitter', 
    'linkedin' => 'LinkedIn',
    // 'microsoft' => 'Microsoft',
    // 'instagram' => 'Instagram',
    // 'github' => 'GitHub',
    // 'yammer' => 'Yammer',
    // 'foursquare' => 'Foursquare',
    // 'soundcloud' => 'SoundCloud',
    // 'vkontakte' => 'VK'
),

Next, you'll have to set the API keys. Open app/config/services.php and set the id and secret for each one. Follow the instructions below for each of the services.

Facebook

Go to Facebook Developers, click on Apps > Create a New App (if you are not a developer you'll have to click on the Register as a Developer to register your developer account), pick a Name and Category and click Create App.

Once the app is created click on the Settings tab and set the App Domains to your website domain (leave it empty if you are working on your localhost server) and Contact Email to your email address.

Then click on the + Add Platform button, select Website and new section will apear. Set the Site URL to the url that points to the oauth.php file, like this: http://yourwebsite.com/oauth.php?provider=facebook. Click Save Changes to save your app settings.

Move to the Status & Review tab and make the app public (or leave it like that if you are just testing).

Finaly go back to the Settings tab and copy the App ID and App Secret to app/config/services.php under the facebook section like this:

'facebook' => array(
    'id' => 'your-app-id',
    'secret' => 'your-app-secret'
),

Google

Go to Google Developers Console, click on Create Project, pick a Name and click Create.

Once the project is created click on the Enable an API button and a list will show. Look for Google+ API and enable it. Next go to the Credentials tab (under APIs & auth) and click on the Create new Client ID button.

Select Web application, set the Authorized JavaScript origins to your website url and Authorized redirect URI to the url that points to the oauth.php file, like this: http://yourwebsite.com/oauth.php?provider=google. Click Create Client ID and a new Client ID for web application will be created.

Finaly copy the CLIENT ID and CLIENT SECRET to app/config/services.php under the google section like:

'google' => array(
    'id' => 'your-client-id',
    'secret' => 'your-client-secret'
),

Twitter

Go to Twitter Developers, click on My applications under your profile picture and then click on the Create New App button. Pick a Name, Description, set the Website to your website url and the Callback URL to the url that points to the oauth.php file, like this: http://yourwebsite.com/oauth.php?provider=twitter and click on the Create your Twitter application button.

Once the app is created go to the API Keys tab and copy API key and API secret to app/config/services.php under the twitter section like this:

'twitter' => array(
    'id' => 'your-api-key',
    'secret' => 'your-api-secret'
),

LinkedIn

Go to LinkedIn Developers, click on API Keys under your profile name and then click on the Add New Application button.

Complete the required fields with information about the app, then for Default Scope check r_fullprofile, r_emailaddress, r_contactinfo and set the OAuth 2.0 Redirect URLs and OAuth 1.0 Accept Redirect URL to the url that points to the oauth.php file, like this: http://yourwebsite.com/oauth.php?provider=linkedin and click on the Add Application button.

Once the app is created copy API Key and Secret Key to app/config/services.php under the linkedin section like this:

'linkedin' => array(
    'id' => 'your-api-key',
    'secret' => 'your-secret-key'
),

Microsoft

Go to Microsoft Developers, click on Create application, pick a Name for the app and click on the I accept button.

Once the app is created go to the API Settings tab and set Redirect URLs to to the url that points to the oauth.php file, like this: http://yourwebsite.com/oauth.php?provider=microsoft and click on the Save button.

Finaly go to the App Settings tab and copy Client ID and Client secret to app/config/services.php under the microsoft section like this:

'microsoft' => array(
    'id' => 'your-client-id',
    'secret' => 'your-client-secret'
),

Instagram

Go to Instagram Developers and click on the Register a New Client button. Pick a Name, Description and enter your Website url, then set OAuth redirect_uri to to the url that points to the oauth.php file, like this: http://yourwebsite.com/oauth.php?provider=instagram and click on the Register button.

Once the client is created copy CLIENT ID and CLIENT SECRET to app/config/services.php under the instagram section like this:

'instagram' => array(
    'id' => 'your-client-id',
    'secret' => 'your-client-secret'
),

GitHub

Go to GitHub Developers and click on the Register new application button. Pick a Name, Descroption and enter your Homepage url, then set Authorization callback URL to the url that points to the oauth.php file, like this: http://yourwebsite.com/oauth.php?provider=github and click on the Register application button.

Once the app is created copy Client ID and Client Secret to app/config/services.php under the github section like this:

'github' => array(
    'id' => 'your-client-id',
    'secret' => 'your-client-secret'
),

Yammer

Go to Yammer Developers, click on the Register New App button, pick a Name, Email, enter your Website url and click Continue.

Next, click on the Basic Info tab and set Redirect URI to the url that points to the oauth.php file, like this: http://yourwebsite.com/oauth.php?provider=yammer and click on the Save button.

Finaly click on the app name and copy Client ID and Client secret to app/config/services.php under the yammer section like this:

'yammer' => array(
    'id' => 'your-client-id',
    'secret' => 'your-client-secret'
),

Foursquare

Go to Foursquare Developers and click on the Create a new app button.

Pick a Name, enter your Website url, and set Redirect URI to the url that points to the oauth.php file, like this: http://yourwebsite.com/oauth.php?provider=foursquare and click on the Save changes button.

Once the app is created copy Client id and Client secret to app/config/services.php under the foursquare section like this:

'foursquare' => array(
    'id' => 'your-client-id',
    'secret' => 'your-client-secret'
),

SoundCloud

Go to SoundCloud Apps, click on the Register a new application button, pick a Name and click Register

Once the app is created enter your Website url, then set Redirect URI to the url that points to the oauth.php file, like this: http://yourwebsite.com/oauth.php?provider=soundcloud and click on the Save app button.

Finaly copy Client ID and Client Secret to app/config/services.php under the soundcloud section like this:

'soundcloud' => array(
    'id' => 'your-client-id',
    'secret' => 'your-client-secret'
),

VK

Go to VK Apps, click on the Create an Application button, pick a Title, set the Category to Website, enter your Website url and lick Connect Site. You'll be asked to enter you phone number so they can send you a confirmation code.

Once the app is created go to the Settings tab and set First API request to to the url that points to the oauth.php file, like this: http://yourwebsite.com/oauth.php?provider=vkontakte and click on the Save button.

Finaly copy Application ID and Secure key to app/config/services.php under the vkontakte section like this:

'vkontakte' => array(
    'id' => 'your-application-id',
    'secret' => 'your-secure-key'
),