Skip to content

Instantly share code, notes, and snippets.

View peksipatongeis's full-sized avatar

Pekka Wallenius peksipatongeis

View GitHub Profile
@peksipatongeis
peksipatongeis / 0 README.md
Created July 11, 2024 07:25 — forked from Tuizi/0 README.md
Auth0 Token + React Router Loader

Use Auth0 JWT Tokens in React Router Dom Loaders

This README outlines the implementation details of passing JWT tokens in a React application using React Router. This is crucial for managing access controls and secure communication between the client and server.

Overview

The application utilizes React Router for navigation and Auth0 for authentication. The main focus is on how to effectively pass JWT tokens retrieved from Auth0 to various components and routes.

Technologies Used

@peksipatongeis
peksipatongeis / index.js
Created May 20, 2019 16:41
AuthContext
function AuthProvider(props) {
const [token, setToken] = useLocalStorage('token', '');
return <AuthContext.Provider value={{ token, setToken }} {...props} />;
}
function useLogin() {
const { setToken } = useContext(AuthContext);
const login = async ({ username, password }) => {
@peksipatongeis
peksipatongeis / markdown.md
Created May 19, 2016 12:37
markdown cheat sheet