19
Hybrid Auth: OAuth + OpenID Erik Eldridge Engineer/Evangelist Yahoo! Developer Network

Hybrid Auth: OpenID + OAuth

Embed Size (px)

DESCRIPTION

>>> This is a draft

Citation preview

Page 1: Hybrid Auth: OpenID + OAuth

Hybrid Auth: OAuth + OpenID

Erik Eldridge

Engineer/Evangelist

Yahoo! Developer Network

Page 2: Hybrid Auth: OpenID + OAuth

Overview

• What, Why, and How of Hybrid Authentication

• Sample code

• Summary

• Resources

Page 3: Hybrid Auth: OpenID + OAuth

What is Hybrid Auth?

• Using OpenID for authentication and Oauth to authorize data access

• Similar to Facebook's Connect, but based on open standards

Page 4: Hybrid Auth: OpenID + OAuth

Why should we use it?

• Easy– Single flow for end-users

• Portable– Open source libraries– Any service can be an OpenID "Provider"– Transferable skill-set and technologies

Page 5: Hybrid Auth: OpenID + OAuth

How do we get started?

• Setup

• Implementation

• Sample

Page 6: Hybrid Auth: OpenID + OAuth

Setup requirements

• Visit developer.yahoo.com/dashboard

• Register an OAuth application

• Download Yahoo! Social SDK from github.com/yahoo

• Download OpenID-Enabled library from openidenabled.com

Page 7: Hybrid Auth: OpenID + OAuth

Generalized implementation

• Define a log in/out mechanism for your site• If user is not logged in, initialize authentication

via OpenID with Simple Registration• In OpenID callback, check if OAuth access

token for user is stored• If access token does not exist, exchange

request token for access token and store access token

• Log in user using local mechanism and begin fetching data using Oauth

Page 8: Hybrid Auth: OpenID + OAuth

Example

• service– index.html– openid/

• index.php• return_to.php• php-openid-2.1.3/

– oauth/• index.php• yahoo-social-php-sdk/

Page 9: Hybrid Auth: OpenID + OAuth

Service/index.html, top

Page 10: Hybrid Auth: OpenID + OAuth

Service/index.html, middle

Page 11: Hybrid Auth: OpenID + OAuth

Service/index.html, bottom

Page 12: Hybrid Auth: OpenID + OAuth

Service/openid/index.php, top

Page 13: Hybrid Auth: OpenID + OAuth

Service/openid/index.php, bottom

Page 14: Hybrid Auth: OpenID + OAuth

Service/openid/return_to.php, top

Page 15: Hybrid Auth: OpenID + OAuth

Service/openid/return_to.php, middle

Page 16: Hybrid Auth: OpenID + OAuth

Service/openid/return_to.php, bottom

Page 17: Hybrid Auth: OpenID + OAuth

Service/oauth/index.php

Page 18: Hybrid Auth: OpenID + OAuth

Summary

• What?– Combination of OpenID authentication and OAuth

authorization

• Why?– Convenient for the end-user: single auth flow

• How?– Yahoo! Social SDK + OpenID-Enabled OpenID

library (with a pinch of YUI and YQL)

Page 19: Hybrid Auth: OpenID + OAuth

Resources

• developer.yahoo.com/openid

• developer.yahoo.com/oauth

• example.erikeldridge.com/{example code}

• Find me on Twitter: @erikeldridge