Top Banner
Social authentication Social authentication in Drupal Solutions, best practices
32

Березовский Андрей - Social Authentication

Jan 14, 2015

Download

Technology

LEDC 2014

 
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: Березовский Андрей - Social Authentication

Social authenticationSocial authentication in Drupal

Solutions, best practices

Page 2: Березовский Андрей - Social Authentication

Hello! My name in AndrewAndrew Berezovsky (duozersk)Full-time Drupal dev for 2+ years5000+ sites using contributed modules (10+

modules)Contest winner -

http://startupturbo.com/contestWorked on forbes.ru; geo.ru; [email protected]; @duozerskD.org - http://drupal.org/user/378397D.ru -

http://www.drupal.ru/username/duozersk

Page 3: Березовский Андрей - Social Authentication

Social authentication?Any OAuth provider

Facebook, Twitter, VK, Google, Yandex, Mail.ru, LinkedIn, Odnoklassniki, …

Any OpenID providerYahoo, Steam, Novell, World of Tanks! Drupal OpenID Provider module -

https://drupal.org/project/openid_provider

Page 4: Березовский Андрей - Social Authentication

Social Login benefitsRegister and login to the site using social

login accountUsers

Easy registration“One-click” loginNo need to remember login/e-mail and

passwordSecurity? (not using the same name/password

combo)Site owners

More registrationsVerified information (e-mail, birthday, real

name, etc.)

Page 5: Березовский Андрей - Social Authentication

Social authentication in Drupal?• BEEN THERE

• Needed a solution• SEEN IT

• Contrib modules were not good enough

• DONE IT• Wrote 2 rings to

rule them all

Page 6: Березовский Андрей - Social Authentication

Two ways to get Social LoginModule per provider

“One ring to rule them all”

Several modules each for one single auth providerCode duplicationBugs duplication Inconsistency

One module with all the providersCode re-useConsistencyCentral identity

management

Page 7: Березовский Андрей - Social Authentication

Possible rings (to rock’em all!)External service

uLogin, Loginza, LoginRadius, Gigya, etc.3rd-party library (open-source)

hybridauth, opauthDIY (work with social APIs directly)

One central module + plugins for providersConnector, Social Connect, Multilogin (Klera

V.); Home-grown solutions (forbes.ru)

Page 8: Березовский Андрей - Social Authentication

How it works?

Your site

Authentication provider

Application

API request

Identity

External service

3rd party

library

DIY

Page 9: Березовский Андрей - Social Authentication

External servicePros ConsSingle unified APINo need to register

applications* Analytics, statistics

(paid option?), other service options

Some services allow you to use your own social applications

External JS dependencyLimited widgets, no

theming* Limited free plans* Integration done by

service devs, not Drupal pros

Provider API change requires service fix (you can’t fix it yourself)

Service branding

External service

Page 10: Березовский Андрей - Social Authentication

3rd party libraryPros ConsSingle unified APINo external JSExtensive themingNo usage limitsBonus functionality

Friend listPost to walls…

Need to register applications

* Provider API change requires library fixHint: you can fix it

yourself, and help everyone else

3rd party

library

Page 11: Березовский Андрей - Social Authentication

DIY solutionPros ConsYou own the code You own the code

Time/money/resourcesNeed to implement every

provider APISupport different and

changing APIs

Page 12: Березовский Андрей - Social Authentication

Good Social Login moduleFast and simple registrationRespect Drupal core settingsMaximum flexibility, configurationSocial identities managementIntegration with contib – Token, Rules, Real

nameNo conflicts with contribEasy widget themingSupport for modal / AJAX forms / redirects

Page 13: Березовский Андрей - Social Authentication

HybridAuth (uLogin)HybridAuth module capabilities, configuration, integration

Page 14: Березовский Андрей - Social Authentication
Page 15: Березовский Андрей - Social Authentication
Page 16: Березовский Андрей - Social Authentication
Page 17: Березовский Андрей - Social Authentication
Page 18: Березовский Андрей - Social Authentication
Page 19: Березовский Андрей - Social Authentication
Page 20: Березовский Андрей - Social Authentication
Page 21: Березовский Андрей - Social Authentication
Page 22: Березовский Андрей - Social Authentication
Page 23: Березовский Андрей - Social Authentication
Page 24: Березовский Андрей - Social Authentication
Page 25: Березовский Андрей - Social Authentication
Page 26: Березовский Андрей - Social Authentication
Page 27: Березовский Андрей - Social Authentication
Page 28: Березовский Андрей - Social Authentication

Identities management

Page 29: Березовский Андрей - Social Authentication

Developer GoodiesWidget – Form API element

Everything is configured trough #propertiesTokensRules integration

Events: identity added/deleted; user created / logged in

Conditions: user registered through HybridAuth

Actions Save remote file to managed file (to use with file

fields) Create date from year/month/day (to use with date

fields) Set destination (no redirect / drupal_goto())

Page 30: Березовский Андрей - Social Authentication

Developer Goodies (cont.)Hooks

hook_hybridauth_username_alter()hook_hybridauth_profile_alter()hook_hybridauth_userinfo_alter()hook_hybridauth_registration_form()hook_hybridauth_registration_block()hook_hybridauth_identity_added()hook_hybridauth_identity_deleted()hook_hybridauth_user_insert()hook_hybridauth_user_login()

Page 31: Березовский Андрей - Social Authentication

Developer Goodies (cont.)

Page 32: Березовский Андрей - Social Authentication

Thank you!Andrew [email protected]@duozersk