Skip to content

frysztak/bearer-auth-react-context

Repository files navigation

Bearer Auth React Context

Bearer Auth React Context is a React Context meant to simplify integrations with APIs using Bearer Token Authorization.

Features:

  • network library (fetch, axios, etc.) agnostic
  • automatically handles token refresh
  • handles various edge cases (e.g.: if two requests fail at the same time, only one refresh request is sent)
  • stores Bearer auth token in localStorage
  • provides convenient wrapper for network calls
  • provides callbacks for when token refresh succeeds or fails
  • plays nice with React-Query

For more details, see docs.

About

Handle Bearer token refresh without pain

Resources

License

Stars

Watchers

Forks

Packages

No packages published