@auth0/auth0-react#Auth0Provider JavaScript Examples

The following examples show how to use @auth0/auth0-react#Auth0Provider. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: index.js    From hiring-system with GNU General Public License v3.0 6 votes vote down vote up
ReactDOM.render(
  <Auth0Provider
    domain={process.env.REACT_APP_DOMAIN}
    clientId={process.env.REACT_APP_CLIENT_ID}
    redirectUri={window.location.origin}
    cacheLocation="localstorage"
  >
    <App />
  </Auth0Provider>,
  document.getElementById("root-app")
);
Example #2
Source File: index.js    From React-JS with MIT License 6 votes vote down vote up
ReactDOM.render(
  <Auth0Provider
    domain={domain}
    clientId={clientId}
    redirectUri={window.location.origin}
  >
    <App />
  </Auth0Provider>
  ,
  document.getElementById('root')
);
Example #3
Source File: index.jsx    From simplQ-frontend with GNU General Public License v3.0 6 votes vote down vote up
ReactDOM.render(
  <Auth0Provider
    domain="simplq.us.auth0.com"
    clientId="9BAywifjAy6n0sx8WbuQubMGGjofpwd6"
    redirectUri={window.location.origin}
    audience="https://devbackend.simplq.me/v1"
    scope="read:current_user update:current_user_metadata"
    cacheLocation="localstorage"
    useRefreshTokens
  >
    <ThemeProvider theme={theme}>
      <Provider store={store}>
        <Layout />
      </Provider>
    </ThemeProvider>
  </Auth0Provider>,
  document.getElementById('root')
);
Example #4
Source File: Auth0.jsx    From Edlib with GNU General Public License v3.0 6 votes vote down vote up
Auth0Wrapper = ({ children }) => {
    const { authServiceSettings: settings, loginRedirectUrl } =
        React.useContext(configContext);

    return (
        <Auth0Provider
            domain={settings.domain}
            clientId={settings.clientId}
            redirectUri={loginRedirectUrl}
            audience={settings.audience}
            scope="edlib:superadmin"
        >
            <Auth0>{children}</Auth0>
        </Auth0Provider>
    );
}
Example #5
Source File: auth0-provider-with-history.js    From graphql-sample-apps with Apache License 2.0 6 votes vote down vote up
Auth0ProviderWithHistory = ({ children }) => {
  const domain = process.env.REACT_APP_AUTH0_DOMAIN || config["REACT_APP_AUTH0_DOMAIN"];
  const clientId = process.env.REACT_APP_AUTH0_CLIENT_ID || config["REACT_APP_AUTH0_CLIENT_ID"];

  return (
    <Auth0Provider
      domain={domain}
      clientId={clientId}
      redirectUri={window.location.origin}
    >
      {children}
    </Auth0Provider>
  );
}
Example #6
Source File: index.js    From graphql-sample-apps with Apache License 2.0 6 votes vote down vote up
ReactDOM.render(
  <Auth0Provider
    domain={domain}
    clientId={clientId}
    redirectUri={window.location.origin}
  >
    <React.StrictMode>
      <ApolloWrapper />
    </React.StrictMode>
  </Auth0Provider>,
  document.getElementById("root")
);
Example #7
Source File: gatsby-browser.js    From TalkTrack with MIT License 6 votes vote down vote up
wrapRootElement = ({ element }) => {
  return (
    <Auth0Provider
      domain={authConfig.domain}
      clientId={authConfig.clientId}
      audience={authConfig.audience}
      redirectUri={window.location.origin}
      onRedirectCallback={onRedirectCallback}
    >
      {element}
    </Auth0Provider>
  );
}
Example #8
Source File: index.js    From willow-grandstack with Apache License 2.0 6 votes vote down vote up
Main = () => (
  <Auth0Provider
    domain={process.env.REACT_APP_AUTH0_DOMAIN}
    clientId={process.env.REACT_APP_AUTH0_CLIENT_ID}
    redirectUri={window.location.origin}
    audience="https://willow.grandstack.io"
  >
    <AppWithApollo />
  </Auth0Provider>
)
Example #9
Source File: App.js    From os-league-tools with MIT License 6 votes vote down vote up
export default function App() {
    useEffect(() => {
        ReactGA.pageview(window.location.pathname + window.location.search);
    }, []);

    return (
        <Provider store={store}>
            <ThemeProvider>
                <div className='App'>
                    <BrowserRouter basename='/'>
                        <Auth0Provider
                            domain='login.osleague.tools'
                            clientId='yfqwKEhQO8FL7MlxWmWo7ekuGgzSrfmh'
                            redirectUri={window.location.origin}
                        >
                            <Routes>
                                <Route path='/' element={<Homepage />} />
                                <Route path='stats' element={<Statistics />} />
                                <Route path='news' element={<Homepage />} />
                                <Route path='tracker' element={<Tracker />} />
                                <Route path='calculators' element={<Calculators />}>
                                    <Route path=':skill' element={<Calculators />} />
                                </Route>
                                <Route path='planners' element={<Calculators />}>
                                    <Route path=':skill' element={<Calculators />} />
                                </Route>
                                <Route path='about' element={<About />} />
                                <Route path='settings' element={<Settings />} />
                            </Routes>
                        </Auth0Provider>
                    </BrowserRouter>
                </div>
            </ThemeProvider>
        </Provider>
    );
}
Example #10
Source File: AuthWithHistory.js    From MeowForm with MIT License 6 votes vote down vote up
Auth0ProviderWithHistory = ({ children }) => {

  const history = useHistory();

  const onRedirectCallback = (appState) => {
    history.push(appState?.returnTo || window.location.pathname);
  };

  return (
    <Auth0Provider
    domain={process.env.REACT_APP_AUTH_DOMAIN}
    clientId={process.env.REACT_APP_CLIENTID}
      redirectUri={window.location.origin}
      onRedirectCallback={onRedirectCallback}
      useRefreshTokens={true}
      cacheLocation="localstorage"
    
    >
      {children}
    </Auth0Provider>
  );
}
Example #11
Source File: auth0-provider-with-history.js    From wedding-planner with MIT License 6 votes vote down vote up
Auth0ProviderWithHistory = ({ children }) => {
  const domain = process.env.REACT_APP_AUTH0_DOMAIN;
  const clientId = process.env.REACT_APP_AUTH0_CLIENT_ID;
  const audience = process.env.REACT_APP_AUDIENCE;

  const history = useHistory();

  const onRedirectCallback = (appState) => {
    history.push(appState?.returnTo || window.location.pathname);
  };

  return (
    <Auth0Provider
      domain={domain}
      clientId={clientId}
      redirectUri={window.location.origin}
      onRedirectCallback={onRedirectCallback}
      audience={audience}
    >
      {children}
    </Auth0Provider>
  );
}