OAuth, IndieAuth, and the Future of Authorization APIs

Open Source Bridge - June 24th, 2014

OAuth, IndieAuth, and the Future of Authorization APIs



Open Source Bridge - June 24th, 2014

aaronparecki.com

@aaronpk

Discussion / Backchannel

2007: Twitter

Twitter Clients (2012)

Twitter Client Attribution

Twitter Stats Apps

The Dark Ages

Obvious problems...

2014:
An "Indie" Web

aaronparecki.com (p3k)

aaronparecki.com (p3k)

werd.io (Known)

bret.io (Jekyll)

kartikprabhu.com (Bundle)

waterpigs.co.uk (Taproot)

tantek.com (Falcon)

kylewm.com (Red Wind)

Current (integrated) Posting Interfaces

Wordpress

p3k

p3k

Known

Red Wind

gregorlove.com

Bundle

Why not post
to your site
from other apps?

Taproot

OwnYourGram

Browser Extension

How does this work?

Working within constraints

IndieAuth:
OAuth 2.0 +
Web Identity

Example:
Signing In

(IndieAuth for identification)

			Application
			client_id = https://indiewebcamp.com/
			redirect_uri = https://indiewebcamp.com/auth/callback
			
				User
				me = https://aaronparecki.com/
			
			
				User's authorization server
				authorization_endpoint = https://indieauth.com/auth
			
		

Delegating to an Authorization Server

aaronparecki.com

			<html lang="en">
			<head>
			    <title>Aaron Parecki</title>
			    <link rel="authorization_endpoint" href="https://indieauth.com/auth">
			</head>
		

"Registering" the redirect_uri

indiewebcamp.com

			<html lang="en">
			<head>
			    <title>IndieWebCamp Wiki</title>
			    <link rel="redirect_uri" href="https://indiewebcamp.com/auth/callback">
			</head>
		

Sign-In Form

When submitted, the server discovers the user's authorization_endpoint, and redirects the browser there with the parameters for the request.

Send the user to their auth server


https://indieauth.com/auth?me=https://aaronparecki.com/&
   client_id=https://indiewebcamp.com/&
   redirect_uri=https://indiewebcamp.com/auth/callback&
   state=1234567890
		

Auth server presents the request

User authenticates, server generates an authorization code

HTTP/1.1 302 Found
Location: https://indiewebcamp.com/auth/callback?
  code=xxxxxxxx&
  state=1234567890&
  me=https://aaronparecki.com/
		

Wiki verifies the authorization code

POST https://indieauth.com/auth
code=xxxxxxxx&
redirect_uri=https://indiewebcamp.com/auth/callback&
client_id=https://indiewebcamp.com&
state=1234567890

HTTP/1.1 200 OK
me=https://aaronparecki.com/
		

User is signed in!

Example:
a "notes" app

(IndieAuth for authorization)

			Application
			client_id = https://quill.p3k.io/
			redirect_uri = https://quill.p3k.io/auth/callback
			
				User
				me = https://aaronparecki.com/
			
			
				User's services
				authorization_endpoint = https://indieauth.com/auth
				token_endpoint = https://tokens.indieauth.com/token
				micropub = https://aaronparecki.com/micropub
			
		

Declaring the endpoints

aaronparecki.com

			<html lang="en">
			<head>
			    <title>Aaron Parecki</title>
			    <link rel="authorization_endpoint" href="https://indieauth.com/auth">
			    <link rel="token_endpoint" href="https://tokens.indieauth.com/token">
			    <link rel="micropub" href="/micropub">
			</head>
		

"Registering" the redirect_uri

quill.p3k.io

			<html lang="en">
			<head>
			    <title>Quill</title>
			    <link rel="redirect_uri" href="https://quill.p3k.io/auth/callback">
			</head>
		

Sign-In Form

When submitted, the server discovers the user's authorization_endpoint, and redirects the browser there with the parameters for the request.

Send the user to their auth server


https://indieauth.com/auth?me=https://aaronparecki.com/&
   client_id=https://quill.p3k.io/&
   redirect_uri=https://quill.p3k.io/auth/callback&
   state=1234567890&
   scope=post
		

Auth server presents the request

User authenticates, server generates an authorization code

HTTP/1.1 302 Found
Location: https://quill.p3k.io/auth/callback?
  code=xxxxxxxx&
  state=1234567890&
  me=https://aaronparecki.com/
		

Quill obtains an access token

POST https://tokens.indieauth.com/token
me=https://aaronparecki.com/&
code=xxxxxxxx&
redirect_uri=https://indiewebcamp.com/auth/callback&
client_id=https://indiewebcamp.com&
state=1234567890&
scope=post
		

Quill obtains an access token

HTTP/1.1 200 OK
me=https://aaronparecki.com/&
access_token=XXXXXX&
scope=post

User is signed in!

Token endpoint verifies the auth code

indiewebcamp.com/token-endpoint

Using the Access Token

Micropub

Micropub

Micropub Endpoint

Micropub Request

POST https://aaronparecki.com/micropub
Authorization: Bearer XXXXXXXXXXXXXXX
Content-Type: application/x-www-form-urlencoded

h=entry&
content=Hello+World
		

Micropub Response

HTTP/1.1 201 Created
Content-Type: application/x-www-form-urlencoded
Location: http://aaronparecki.com/notes/2014/06/23/1/
Link: <http://aaron.pk/n4Wj1> rel="shortlink"
		

Creating other types of content

Post with Location

POST https://aaronparecki.com/micropub
Authorization: Bearer XXXXXXXXXXXXXXX
Content-Type: application/x-www-form-urlencoded

h=entry&
content=Hello+World
location=geo:45.525185,-122.681633
		

Micropub Photo Post

POST https://aaronparecki.com/micropub
Authorization: Bearer XXXXXXXXXXXXXXX
Content-Type: multipart/form-data; boundary=-------xxxxxx
-------xxxxxx
Content-Disposition: form-data; name="h"
entry
-------xxxxxx
Content-Disposition: form-data; name="content"
Grabbing a drink and working on my slides while waiting to 
get my hair cut! 🍸☀️✂️👍
-------xxxxxx
Content-Disposition: form-data; name="file"; filename="photo.jpg"
Content-Type: image/jpeg
[image data]

		

Micropub

What Next?

Quantified Self Data

IndieWebCamp Events!

indiewebcamp.com/events

Thanks!