在线时间:8:00-16:00
迪恩网络APP
随时随地掌握行业动态
扫描二维码
关注迪恩网络微信公众号
开源软件名称(OpenSource Name):oktadev/okta-react-graphql-example开源软件地址(OpenSource Url):https://github.com/oktadev/okta-react-graphql-example开源编程语言(OpenSource Language):TypeScript 64.5%开源软件介绍(OpenSource Introduction):Health Tracking App with React, GraphQL, and TypeORMThis example app shows how to use React, GraphQL, and TypeORM to build a health tracking app and add authentication with Okta. Please read Build a Health Tracking App with React and GraphQL, and TypeORM to see how this app was created. Prerequisites: Node.js.
Getting StartedTo install this example application, run the following commands: git clone https://github.com/oktadeveloper/okta-react-graphql-example.git
cd okta-react-graphql-example This will get a copy of the project installed locally. To install all of its dependencies and start each app, follow the instructions below. To run the GraphQL API, cd into the npm i This project is configured to use a MySQL database. You can change its settings by modifying mysql -u root -p
create database healthpoints;
use healthpoints;
grant all privileges on *.* to 'health'@'localhost' identified by 'points'; After this database exists, start the API with To run the client, cd into the npm i
npm start Setup OktaLog in to your Okta Developer account (or sign up if you don’t have an account) and navigate to Applications > Add Application. Click Single-Page App, click Next, and give the app a name you’ll remember. Click Done. Server ConfigurationOpen const oktaJwtVerifier = new OktaJwtVerifier({
clientId: '{yourClientId}',
issuer: 'https://{yourOktaDomain}/oauth2/default'
}); NOTE: The value of Client ConfigurationFor the client, set the class App extends Component {
render() {
return (
<Router>
<Security issuer='https://{yourOktaDomain}.com/oauth2/default'
client_id='{yourClientId}'
redirect_uri={window.location.origin + '/implicit/callback'}
onAuthRequired={onAuthRequired}>
<Route path='/' exact={true} component={Home}/>
<SecureRoute path='/points' component={Points}/>
<Route path='/login' render={() => <Login baseUrl='https://dev-669532.oktapreview.com'/>}/>
<Route path='/implicit/callback' component={ImplicitCallback}/>
</Security>
</Router>
);
}
} LinksThis example uses the following libraries provided by Okta: HelpPlease post any questions as comments on the blog post, or visit our Okta Developer Forums. You can also email [email protected] if you would like to create a support ticket. LicenseApache 2.0, see LICENSE. |
2023-10-27
2022-08-15
2022-08-17
2022-09-23
2022-08-13
请发表评论