Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit b090307

Browse files
committed
Added Bootstrap, routes and OIDC redirection for authentication
1 parent 0aeb147 commit b090307

File tree

3 files changed

+51
-19
lines changed

3 files changed

+51
-19
lines changed

‎package.json

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,18 @@
33
"version": "0.1.0",
44
"private": true,
55
"dependencies": {
6+
"@openid/appauth": "^1.2.6",
67
"@testing-library/jest-dom": "^4.2.4",
78
"@testing-library/react": "^9.4.0",
89
"@testing-library/user-event": "^7.2.1",
10+
"bootstrap": "^4.4.1",
911
"react": "^16.12.0",
1012
"react-dom": "^16.12.0",
13+
"react-router-dom": "^5.1.2",
1114
"react-scripts": "3.3.0"
1215
},
1316
"scripts": {
14-
"start": "react-scripts start",
17+
"start": "PORT=4200 react-scripts start",
1518
"build": "react-scripts build",
1619
"test": "react-scripts test",
1720
"eject": "react-scripts eject"

‎src/App.js

Lines changed: 26 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,33 @@
11
import React from 'react';
2-
import logo from './logo.svg';
3-
import './App.css';
2+
import {BrowserRouter as Router, Route, Link} from 'react-router-dom';
3+
import {Home} from "./Home";
4+
import {Profile} from "./Profile";
5+
import {Callback} from "./Callback";
46

57
function App() {
8+
69
return (
7-
<div className="App">
8-
<header className="App-header">
9-
<img src={logo} className="App-logo" alt="logo" />
10-
<p>
11-
Edit <code>src/App.js</code> and save to reload.
12-
</p>
13-
<a
14-
className="App-link"
15-
href="https://reactjs.org"
16-
target="_blank"
17-
rel="noopener noreferrer"
18-
>
19-
Learn React
20-
</a>
21-
</header>
22-
</div>
10+
<Router>
11+
<nav className="navbar navbar-expand-lg navbar-dark bg-primary">
12+
<a className="navbar-brand" href="/">App-Auth JS Demo</a>
13+
<div className="collapse navbar-collapse" id="navbarNav">
14+
<ul className="navbar-nav">
15+
<li className="nav-item">
16+
<Link className="nav-link" to="/">Home</Link>
17+
</li>
18+
<li className="nav-item">
19+
<Link className="nav-link" to="/user">User</Link>
20+
</li>
21+
</ul>
22+
</div>
23+
</nav>
24+
25+
<div>
26+
<Route exact path="/" component={Home}/>
27+
<Route exact path="/profile" component={Profile}/>
28+
<Route exact path="/callback" component={Callback}/>
29+
</div>
30+
</Router>
2331
);
2432
}
2533

‎src/environment.js

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
const dev = {
2+
clientId: 'xGZxEAJhzlkuQUlWl90y1ntIX-0UDWHx',
3+
OPServer: 'https://kdhttps.auth0.com',
4+
redirectURL: 'http://localhost:4200/callback',
5+
scope: 'openid email profile',
6+
userInfoEndpoint: '/userinfo',
7+
extra: {prompt: 'consent', access_type: 'offline'}
8+
};
9+
10+
const prod = {
11+
12+
};
13+
14+
const config = process.env.REACT_APP_STAGE === 'production'
15+
? prod
16+
: dev;
17+
18+
export default {
19+
// Add common config values here
20+
...config
21+
};

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /