Implementing OAuth 2.0 from SCRATCH

  Рет қаралды 1,583

Carberra

Carberra

Ай бұрын

Even if you choose not to implement it yourself in your application, OAuth 2.0 is definitely one of those things that's useful to know inside and out. In this video, we'll be implementing it in Python using the requests library!
-
If you enjoy my content, consider supporting me on Patreon or becoming a member!
• Patreon: / carberra
• Membership: / @carberra
Follow me elsewhere for even more Carberra!
• Discord: / discord
• Instagram: / carberratutorials
I get a lot of people asking, so here's my setup!
• Visual Studio Code: • My Visual Studio Code ...
• Terminal: • Make your terminal loo...
-
If you have any questions, don't hesitate to ask in the comments! I'll try and answer as soon as I can, providing someone else hasn't already done so.
#python #coding #howto

Пікірлер: 11
@TheDiamondRoblox
@TheDiamondRoblox Ай бұрын
Thank you! It’s something new I learned tbh ❤
@KossackFrank
@KossackFrank Ай бұрын
Thanks, this will be very helpful, refactoring my oauth … sadly not all provided libraries are easy to use
@ronalddebruijn613
@ronalddebruijn613 Ай бұрын
Great explanation. It will improve my access/refresh handling! I wrote an ugly selenium script to automate the authorize part. For my application the access/refresh tokens are very shortlived. Have you (or anybody) thought about automating the authorization part?
@Carberra
@Carberra Ай бұрын
Thanks! As far as I know the authorisation part is designed specifically so it can't be automated. I don't know if anyone's managed it, but I tried once and couldn't manage it. I didn't try anything with Selenium though.
@ronalddebruijn613
@ronalddebruijn613 Ай бұрын
I think Selenium is kind of last resort to hack the unhackable. I don't think it will be resistant to changes on the website. But for now it avoids many clicks...There might me more maintable options than Selenium. But my knowledge here is limited...
@birdie123
@birdie123 Ай бұрын
The json module has a "load" method to read a json file directly. There is no need to use either OS or Pathlib to load the json file. 😜 # Typical usage: with ("secrets.json", "r") as file: secrets = json.load(file)
@Carberra
@Carberra Ай бұрын
Can't one-line it though! (Well, unless you don't close it.)
@birdie123
@birdie123 Ай бұрын
​@@Carberra Oops mistake... it should have been with open("secrets.json", "r") as file: secrets = json.load(file)
@yibowei9636
@yibowei9636 Ай бұрын
I prefer Pathlib for all file-system operations because it's a lot easier to handle exceptions, relative/absolute conversions, and most importantly one-line code for read/write operations.
@birdie123
@birdie123 Ай бұрын
@@yibowei9636 I might argue that using the "with" keyword (context manager) is more "Pythonic". 🐍🐍🐍 If handling exception/s is required, I tend to use the following: try: with open(file, "r") as file: # do something json.load(file) except IOError as ioe: print(ioe) except Exception as e: print(e)
@davidmurphy563
@davidmurphy563 Ай бұрын
Dunno... It's good to learn about these things but I don't think I'd ever be comfortable writing security critical things like this myself. There's a long, careful academic / peer / deployment process the libraries go through that I just couldn't duplicate on my own. Nah, I'd never get above 99.9% confident there wasn't a hidden exploit and that's just not good enough... On this sort of thing I'm going to be risk adverse and use a library all day long.
Python has BIOMETRIC support?!
11:43
Carberra
Рет қаралды 2,1 М.
5 tips for CLEAN Python code
19:13
Carberra
Рет қаралды 2,6 М.
How Many Balloons Does It Take To Fly?
00:18
MrBeast
Рет қаралды 25 МЛН
ОСКАР ИСПОРТИЛ ДЖОНИ ЖИЗНЬ 😢 @lenta_com
01:01
OAuth 2.0 and OpenID Connect (in plain English)
1:02:17
OktaDev
Рет қаралды 1,7 МЛН
Simplify React and Phoenix using Inertia JS: A quick look
6:46
Code & Stuff
Рет қаралды 2,7 М.
Will Python SKIP these versions?
9:58
Carberra
Рет қаралды 3,5 М.
OAuth 2.0: Implicit, Authorization Code, and PKCE
9:12
Ping Identity TV
Рет қаралды 13 М.
The Ultimate Guide to Gleam Concurrency
13:36
Isaac Harris-Holt
Рет қаралды 13 М.
`const` was a mistake
31:50
Theo - t3․gg
Рет қаралды 127 М.
FastAPI + Github OAuth
14:19
Will Estes
Рет қаралды 7 М.
I Trained an AI with 10,000 Memes
14:52
Coding with Lewis
Рет қаралды 247 М.