Top Banner
Ember and OAuth2 Boston Ember.js March 9, 2017 Stephen Vance
12

Ember and OAuth2

Apr 12, 2017

Download

Software

Stephen Vance
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: Ember and OAuth2

Ember and OAuth2Boston Ember.js March 9, 2017 Stephen Vance

Page 2: Ember and OAuth2

What We’ll Cover

• What is OAuth2?

• ember-simple-auth

• torii

• The Big Picture

2

Page 3: Ember and OAuth2

OAuth2• Authentication (who you are) and Authorization (what can you do)

• OAuth is an authorization protocol

• Why do we use it for authentication?

• Implicit and authorization code grant types

• Scopes

3

Page 4: Ember and OAuth2

Authorization Code Grant

AppBob1. Use GitHub

GitHub2. Bob wants access

3. Can App have access?

4. Bob says yes (authorization code)

Auth Server

5. I need a key

6. A

uth

code

+

secr

et

7. Token + scopes

8. Token + scopes

4

Page 5: Ember and OAuth2

ember-simple-auth (ESA)

Client-side session

Authenticates the session

Authorizes requests

5

Page 6: Ember and OAuth2

How ESA Works• session service

• Authenticators (ToriiAuthenticator)

• ApplicationRouteMixin

• AuthenticatedRouteMixin

• UnauthenticatedRouteMixin

• Authorizers

• DataAdapterMixin

6

Page 7: Ember and OAuth2

Torii

Providers

Session Manager

Adapters

7

Page 8: Ember and OAuth2

How torii Works

• Simple API: open, fetch, close

• Can be used by itself (e.g., ember-twiddle)

8

Page 9: Ember and OAuth2

9

Page 10: Ember and OAuth2

For Reference• OAuth2 RFC: https://tools.ietf.org/html/rfc6749

• Section 4.1 details Authorization Code Grant

• ember-simple-auth: https://github.com/simplabs/ember-simple-auth

• GitHub with torii Guide: https://github.com/simplabs/ember-simple-auth/blob/master/guides/auth-torii-with-github.md

• torii: https://github.com/Vestorly/torii

• GitHub API docs: https://developer.github.com/v3/

• OAuth details: https://developer.github.com/v3/oauth/

• ember-data-github: https://github.com/elwayman02/ember-data-github

10

Page 11: Ember and OAuth2

Usage Examples

• https://github.com/srvance/simple-auth-torii-github-demo

• https://github.com/srvance/git-time-machine

• https://github.com/ember-cli/ember-twiddle

• https://github.com/hawkup/github-stars

11

Page 12: Ember and OAuth2

Contact MeStephen Vance

http://www.vance.com

[email protected]

@StephenRVance

srvance on GitHub and LinkedIn

12