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
Massimiliano Pippi
April 10, 2015
Programming
0
190
Protect a Django REST api with Oauth2
Lightning talk for pycon15
Massimiliano Pippi
April 10, 2015
Tweet
Share
More Decks by Massimiliano Pippi
See All by Massimiliano Pippi
Finding the needle: a deep dive into the rewriting of Haystack
masci
0
110
Project layout patterns in Go
masci
1
530
A Python and a Gopher walk into a bar - Embedding Python in Go. (dotGo2017)
masci
0
820
A Python and a Gopher walk into a bar - Embedding Python in Go.
masci
0
330
How to port your Python software to Go without people noticing
masci
0
240
Python - Go One Way
masci
0
230
How we stopped using the mouse and started drawing molecules with our fingertips: not the usual porting story
masci
0
120
Django 1.7 on App Engine
masci
0
220
If code is poetry, then documentation is prose
masci
0
170
Other Decks in Programming
See All in Programming
Data-Centric Kaggle
isax1015
2
710
[AI Engineering Summit Tokyo 2025] LLMは計画業務のゲームチェンジャーか? 最適化業務における活⽤の可能性と限界
terryu16
2
540
20260127_試行錯誤の結晶を1冊に。著者が解説 先輩データサイエンティストからの指南書 / author's_commentary_ds_instructions_guide
nash_efp
0
710
[KNOTS 2026登壇資料]AIで拡張‧交差する プロダクト開発のプロセス および携わるメンバーの役割
hisatake
0
170
今こそ知るべき耐量子計算機暗号(PQC)入門 / PQC: What You Need to Know Now
mackey0225
3
350
副作用をどこに置くか問題:オブジェクト指向で整理する設計判断ツリー
koxya
1
560
なぜSQLはAIぽく見えるのか/why does SQL look AI like
florets1
0
390
0→1 フロントエンド開発 Tips🚀 #レバテックMeetup
bengo4com
0
520
2年のAppleウォレットパス開発の振り返り
muno92
PRO
0
190
2026年 エンジニアリング自己学習法
yumechi
0
110
Honoを使ったリモートMCPサーバでAIツールとの連携を加速させる!
tosuri13
1
170
インターン生でもAuth0で認証基盤刷新が出来るのか
taku271
0
190
Featured
See All Featured
How to Create Impact in a Changing Tech Landscape [PerfNow 2023]
tammyeverts
55
3.2k
Build The Right Thing And Hit Your Dates
maggiecrowley
38
3k
What does AI have to do with Human Rights?
axbom
PRO
0
1.9k
Efficient Content Optimization with Google Search Console & Apps Script
katarinadahlin
PRO
0
300
Rebuilding a faster, lazier Slack
samanthasiow
85
9.4k
Helping Users Find Their Own Way: Creating Modern Search Experiences
danielanewman
31
3.1k
Documentation Writing (for coders)
carmenintech
77
5.2k
The World Runs on Bad Software
bkeepers
PRO
72
12k
Embracing the Ebb and Flow
colly
88
5k
How to Align SEO within the Product Triangle To Get Buy-In & Support - #RIMC
aleyda
1
1.4k
The State of eCommerce SEO: How to Win in Today's Products SERPs - #SEOweek
aleyda
2
9.4k
Optimising Largest Contentful Paint
csswizardry
37
3.6k
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