这是indexloc提供的服务,不要输入任何密码
Skip to content

Conversation

@danielgtaylor
Copy link
Owner

This takes some of the information from #202 and #186 and tries to put together a simple how-to for people wanting to add OAuth 2.0 based auth with JWTs to their API.

@codecov
Copy link

codecov bot commented Jan 9, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Comparison is base (7f6db28) 93.45% compared to head (498ab8a) 93.45%.
Report is 3 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main     #204   +/-   ##
=======================================
  Coverage   93.45%   93.45%           
=======================================
  Files          17       17           
  Lines        2184     2184           
=======================================
  Hits         2041     2041           
  Misses        105      105           
  Partials       38       38           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link
Contributor

@Insei Insei left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great work! It's a nice description!

Copy link
Contributor

@sm3142 sm3142 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@danielgtaylor Thanks for the good work. I think this will help a lot of people!

I tried to clear up some of the misconceptions regarding what OAuth2 is (authorization) and isn't (authentication) and OAuth2 being quasi synonymous with JWT (it is not). Fell free to use these suggestions or not - as I mentioned elsewhere, the distinction is not super important for the purpose of the document.

I also added a section regarding different token formats. Since I will have to do just that in the not so distant future (i.e. use opaque access tokens), I may be able to provide an abstract implementation at a later stage.

danielgtaylor and others added 7 commits January 11, 2024 10:17
Co-authored-by: Stefan Moser <6841360+sm3142@users.noreply.github.com>
Co-authored-by: Stefan Moser <6841360+sm3142@users.noreply.github.com>
Co-authored-by: Stefan Moser <6841360+sm3142@users.noreply.github.com>
Co-authored-by: Stefan Moser <6841360+sm3142@users.noreply.github.com>
Co-authored-by: Stefan Moser <6841360+sm3142@users.noreply.github.com>
Co-authored-by: Stefan Moser <6841360+sm3142@users.noreply.github.com>
Co-authored-by: Stefan Moser <6841360+sm3142@users.noreply.github.com>
danielgtaylor and others added 3 commits January 16, 2024 20:38
Co-authored-by: Stefan Moser <6841360+sm3142@users.noreply.github.com>
Co-authored-by: Stefan Moser <6841360+sm3142@users.noreply.github.com>
@danielgtaylor
Copy link
Owner Author

danielgtaylor commented Jan 17, 2024

@sm3142 @Insei sorry for the delay. I caught covid and have been pretty sick. Thanks for all the help, I've applied all the suggestions and will merge this in, but feel free to open additional PRs if you think anything else should get added or updated 👍🏻

Edit: it's live now at https://huma.rocks/how-to/oauth2-jwt/

@danielgtaylor danielgtaylor merged commit d27de54 into main Jan 17, 2024
@danielgtaylor danielgtaylor deleted the how-to-oauth2-jwt branch January 17, 2024 05:00
@sm3142
Copy link
Contributor

sm3142 commented Jan 17, 2024

@danielgtaylor, hope you feel better now. Thanks for all the effort!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants