Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
Protect a Django REST api with Oauth2
Search
Sponsored
·
Ship Features Fearlessly
Turn features on and off without deploys. Used by thousands of Ruby developers.
→
Massimiliano Pippi
April 10, 2015
Programming
200
0
Share
Protect a Django REST api with Oauth2
Lightning talk for pycon15
Massimiliano Pippi
April 10, 2015
More Decks by Massimiliano Pippi
See All by Massimiliano Pippi
Finding the needle: a deep dive into the rewriting of Haystack
masci
0
140
Project layout patterns in Go
masci
1
550
A Python and a Gopher walk into a bar - Embedding Python in Go. (dotGo2017)
masci
0
850
A Python and a Gopher walk into a bar - Embedding Python in Go.
masci
0
350
How to port your Python software to Go without people noticing
masci
0
260
Python - Go One Way
masci
0
240
How we stopped using the mouse and started drawing molecules with our fingertips: not the usual porting story
masci
0
140
Django 1.7 on App Engine
masci
0
240
If code is poetry, then documentation is prose
masci
0
200
Other Decks in Programming
See All in Programming
生成AI時代にこそ効くGo | Why Go Works in the Age of Generative AI
mom0tomo
8
3.1k
AI時代のUIはどこへ行く?その2!
yusukebe
17
5.7k
Modding RubyKaigi for Myself
yui_knk
0
840
正しくソフトウェアを作る、前提を疑うための認知の視点 / doubt-premise
minodriven
4
1.6k
運用エージェントは "作る" から "育てる" へ - 記憶と自己進化の3層設計パターン / self-evolving-agents-three-layer-agent-design
gawa
12
3.3k
ふつうのFeature Flag実践入門
irof
7
3.4k
Talking to terminals (and how they talk back) (KotlinConf 2026)
jakewharton
PRO
1
170
Inspired By RubyKaigi (EN)
atzzcokek
0
470
Make SRE Operations Easier with Azure SRE Agent
kkamegawa
0
2.5k
ビジネスモデルから紐解く、AI+型駆動開発
hirokiomote
2
4.9k
サーバーレスで作る、動画データ管理基盤
oyasumipants
0
320
自動レビューエンジンの実装と運用 ~レビューのない世界へ~
kurukuru1999
2
310
Featured
See All Featured
Winning Ecommerce Organic Search in an AI Era - #searchnstuff2025
aleyda
1
2k
Max Prin - Stacking Signals: How International SEO Comes Together (And Falls Apart)
techseoconnect
PRO
0
170
Building Adaptive Systems
keathley
44
3k
How to Ace a Technical Interview
jacobian
281
24k
Why You Should Never Use an ORM
jnunemaker
PRO
61
9.9k
Easily Structure & Communicate Ideas using Wireframe
afnizarnur
194
17k
Navigating Team Friction
lara
192
16k
Building AI with AI
inesmontani
PRO
1
1k
Marketing Yourself as an Engineer | Alaka | Gurzu
gurzu
0
210
Embracing the Ebb and Flow
colly
88
5.1k
[Rails World 2023 - Day 1 Closing Keynote] - The Magic of Rails
eileencodes
38
2.9k
Google's AI Overviews - The New Search
badams
0
1k
Transcript
Protect a Django REST API with OAuth2 Massimiliano Pippi @maxpippi
Introducing my friend Harold Let’s say we want to write
a timetracking web application y u not pushing? git push -f works lol
Backend recipe Django & Django REST Framework u can use
the new DRF3 generic views here wut?
Projects proliferation timetracker-backend timetracker-web timetracker-[android|ios] timetracker-desktop yep! I need an
app for my nokia 3210
How do we do access control? Third party apps want
to access our data as well! not ma problem can’t hear u
Common problems • Using user credentials inside the app is
a bad idea • The app might have full access to user account • User has to change his password to revoke the access
Multiple problems - one Solution The OAuth2 framework omg not
oauth again
Django OAuth Toolkit • Django 1.4 → 1.7 (1.8 coming
soon) • Python 2&3 • built on top of oauthlib, RFC 6749 compliant • DRF 2&3 integration https://github.com/evonove/django-oauth-toolkit
Batteries included • builtin views to register and manage OAuth2
applications • form view for user authorization lol I found what DRF stands for omg harold plz retire
Endpoints protection for the lazy • function views decorators @protected_resource()
def my_view(request): # A valid token is required to get here… • generic class based views class ApiEndpoint(ProtectedResourceView): def get(self, request, *args, **kwargs): return HttpResponse('Hello, OAuth2!')
DRF ootb integration REST_FRAMEWORK = { 'DEFAULT_AUTHENTICATION_CLASSES': ( 'oauth2_provider.ext.rest_framework.OAuth2Authentication', )
}
Future plans - Help needed! OAuth1 support Resource and Authorization
server components separation https://github.com/evonove/django-oauth-toolkit +1 for my own PR