Created Woodpecker CI/CD deployment
- Created Dockerfile for packing up API and Web projects as Docker image
This commit is contained in:
36
Web/src/components/auth0ProviderWithNavigate.jsx
Normal file
36
Web/src/components/auth0ProviderWithNavigate.jsx
Normal file
@ -0,0 +1,36 @@
|
||||
import { Auth0Provider } from "@auth0/auth0-react";
|
||||
import React from "react";
|
||||
import { useNavigate } from "react-router-dom";
|
||||
|
||||
export const Auth0ProviderWithNavigate = ({ children }) => {
|
||||
const navigate = useNavigate();
|
||||
|
||||
const domain = process.env.REACT_APP_AUTH0_DOMAIN;
|
||||
const clientId = process.env.REACT_APP_AUTH0_CLIENT_ID;
|
||||
const redirectUri = process.env.REACT_APP_AUTH0_CALLBACK_URL;
|
||||
const audience = process.env.REACT_APP_AUTH0_AUDIENCE;
|
||||
|
||||
const onRedirectCallback = (appState) => {
|
||||
navigate(appState?.returnTo || window.location.pathname);
|
||||
};
|
||||
|
||||
if (!(domain && clientId && redirectUri)) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return (
|
||||
<Auth0Provider
|
||||
domain={domain}
|
||||
clientId={clientId}
|
||||
authorizationParams={{
|
||||
redirect_uri: redirectUri,
|
||||
audience: audience
|
||||
}}
|
||||
onRedirectCallback={onRedirectCallback}
|
||||
useRefreshTokens={true}
|
||||
cacheLocation="localstorage"
|
||||
>
|
||||
{children}
|
||||
</Auth0Provider>
|
||||
);
|
||||
};
|
||||
Reference in New Issue
Block a user