This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React from "react"; | |
const About = () => ( | |
<div> | |
<h1>About</h1> | |
</div> | |
); | |
export default About; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React, { Suspense } from 'react'; | |
import { | |
BrowserRouter as Router, | |
Switch, | |
Route, | |
Link | |
} from "react-router-dom"; | |
const About = React.lazy(() => import("./About")); | |
const ActiveUsers = React.lazy(() => import("./ActiveUsers")); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React from 'react'; | |
import ReactDOM from 'react-dom'; | |
import './index.css'; | |
import App from './App'; | |
import * as serviceWorker from './serviceWorker'; | |
import { Auth0Provider } from "@auth0/auth0-react"; | |
ReactDOM.render( | |
<React.StrictMode> | |
<Auth0Provider |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React from 'react'; | |
import { Navbar, Nav, Button } from "react-bootstrap" | |
import { useAuth0 } from "@auth0/auth0-react"; | |
import 'bootstrap/dist/css/bootstrap.min.css'; | |
const App = () => { | |
const { loginWithRedirect } = useAuth0(); | |
return ( | |
<div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React from 'react'; | |
import { Navbar, Nav, Button } from "react-bootstrap" | |
import { useAuth0 } from "@auth0/auth0-react"; | |
import 'bootstrap/dist/css/bootstrap.min.css'; | |
const App = () => { | |
const { loginWithRedirect, isAuthenticated, logout } = useAuth0(); | |
return ( | |
<div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React from "react"; | |
import { useAuth0 } from "@auth0/auth0-react"; | |
import { Container, Card, Button } from "react-bootstrap" | |
const UserProfile = () => { | |
const { user, isAuthenticated, isLoading } = useAuth0(); | |
if (isLoading) { | |
return <div>Loading ...</div>; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React from 'react'; | |
import { Navbar, Nav, Button } from "react-bootstrap" | |
import { useAuth0 } from "@auth0/auth0-react"; | |
import 'bootstrap/dist/css/bootstrap.min.css'; | |
import UserProfile from "./UserProfile"; | |
const App = () => { | |
const { loginWithRedirect, isAuthenticated, logout } = useAuth0(); | |
return ( |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const express = require('express'); | |
const app = express(); | |
const jwt = require('express-jwt'); | |
const jwks = require('jwks-rsa'); | |
const jwtAuthz = require('express-jwt-authz'); | |
app.use(jwt({ | |
secret: jwks.expressJwtSecret({ | |
cache: true, | |
rateLimit: true, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const checkScopes = permissions => jwtAuthz(permissions); | |
app.get('/users', checkScopes(['read:users']), (req, res) => { | |
res.json({ users: [{ id: 1 }, { id: 2 }] }) | |
}) | |
app.post('/user', checkScopes(['create:users']), (req, res) => { | |
res.sendStatus(201); | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function addRolesFromSqlServer(user, context, callback) { | |
const tedious = require('tedious'); | |
// Roles should only be set to verified users. | |
if (!user.email || !user.email_verified) { | |
return callback(null, user, context); | |
} | |
getRoles(user.email, (err, roles) => { | |
if (err) return callback(err); |
OlderNewer