Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1,096 changes: 1,022 additions & 74 deletions javascript/package-lock.json

Large diffs are not rendered by default.

2 changes: 2 additions & 0 deletions javascript/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
"./Archived/embedded-login-davinci/",
"./central-login-oidc/",
"./central-login-oidc-client/",
"./react-oidc/",
"./embedded-login/",
"./reactjs-todo/",
"./reactjs-todo-davinci/",
Expand All @@ -23,6 +24,7 @@
"reactjs-todo-dv": "npm start --workspace reactjs-todo-davinci",
"start:central-login-oidc": "npm start --workspace central-login-oidc",
"start:central-login-oidc-client": "npm start --workspace central-login-oidc-client",
"start:react-oidc": "npm start --workspace react-oidc",
"start:embedded-login": "npm start --workspace embedded-login",
"start:angular-todo": "npm-run-all --parallel todo-api angular-todo",
"start:reactjs-todo": "npm-run-all --parallel todo-api reactjs-todo",
Expand Down
5 changes: 5 additions & 0 deletions javascript/react-oidc/.env.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
VITE_PORT=8443
# VITE_SCOPE - For PingOne servers, the `revoke` scope must be set as well.
VITE_SCOPE=
VITE_WEB_OAUTH_CLIENT=
VITE_WELLKNOWN_URL=
24 changes: 24 additions & 0 deletions javascript/react-oidc/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# Logs
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*
pnpm-debug.log*
lerna-debug.log*

node_modules
dist
dist-ssr
*.local

# Editor directories and files
.vscode/*
!.vscode/extensions.json
.idea
.DS_Store
*.suo
*.ntvs*
*.njsproj
*.sln
*.sw?
50 changes: 50 additions & 0 deletions javascript/react-oidc/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
# React + TypeScript + Vite

This template provides a minimal setup to get React working in Vite with HMR and some ESLint rules.

Currently, two official plugins are available:

- [@vitejs/plugin-react](https://github.com/vitejs/vite-plugin-react/blob/main/packages/plugin-react/README.md) uses [Babel](https://babeljs.io/) for Fast Refresh
- [@vitejs/plugin-react-swc](https://github.com/vitejs/vite-plugin-react-swc) uses [SWC](https://swc.rs/) for Fast Refresh

## Expanding the ESLint configuration

If you are developing a production application, we recommend updating the configuration to enable type aware lint rules:

- Configure the top-level `parserOptions` property like this:

```js
export default tseslint.config({
languageOptions: {
// other options...
parserOptions: {
project: ['./tsconfig.node.json', './tsconfig.app.json'],
tsconfigRootDir: import.meta.dirname,
},
},
})
```

- Replace `tseslint.configs.recommended` to `tseslint.configs.recommendedTypeChecked` or `tseslint.configs.strictTypeChecked`
- Optionally add `...tseslint.configs.stylisticTypeChecked`
- Install [eslint-plugin-react](https://github.com/jsx-eslint/eslint-plugin-react) and update the config:

```js
// eslint.config.js
import react from 'eslint-plugin-react'

export default tseslint.config({
// Set the react version
settings: { react: { version: '18.3' } },
plugins: {
// Add the react plugin
react,
},
rules: {
// other rules...
// Enable its recommended rules
...react.configs.recommended.rules,
...react.configs['jsx-runtime'].rules,
},
})
```
28 changes: 28 additions & 0 deletions javascript/react-oidc/eslint.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
import js from '@eslint/js'
import globals from 'globals'
import reactHooks from 'eslint-plugin-react-hooks'
import reactRefresh from 'eslint-plugin-react-refresh'
import tseslint from 'typescript-eslint'

export default tseslint.config(
{ ignores: ['dist'] },
{
extends: [js.configs.recommended, ...tseslint.configs.recommended],
files: ['**/*.{ts,tsx}'],
languageOptions: {
ecmaVersion: 2020,
globals: globals.browser,
},
plugins: {
'react-hooks': reactHooks,
'react-refresh': reactRefresh,
},
rules: {
...reactHooks.configs.recommended.rules,
'react-refresh/only-export-components': [
'warn',
{ allowConstantExport: true },
],
},
},
)
21 changes: 21 additions & 0 deletions javascript/react-oidc/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
<!-- /*
*
* index.html
*
* Copyright (c) 2026 Ping Identity Corporation. All rights reserved.
* This software may be modified and distributed under the terms
* of the MIT license. See the LICENSE file for details.
*/ -->
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<link rel="icon" type="image/x-icon" href="favicon.ico" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Ping SDK Centralized Login Sample - OpenID Connect</title>
</head>
<body>
<div id="root"></div>
<script type="module" src="/src/main.tsx"></script>
</body>
</html>
30 changes: 30 additions & 0 deletions javascript/react-oidc/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
{
"name": "react-oidc",
"private": true,
"version": "0.0.0",
"type": "module",
"scripts": {
"start": "vite",
"build": "tsc -b && vite build",
"lint": "eslint .",
"preview": "vite preview"
},
"dependencies": {
"@forgerock/oidc-client": "^1.3.0-beta-0.1.0",
"react": "^18.3.1",
"react-dom": "^18.3.1"
},
"devDependencies": {
"@eslint/js": "^9.13.0",
"@types/react": "^18.3.12",
"@types/react-dom": "^18.3.1",
"@vitejs/plugin-react": "^4.3.3",
"eslint": "^9.13.0",
"eslint-plugin-react-hooks": "^5.0.0",
"eslint-plugin-react-refresh": "^0.4.14",
"globals": "^15.11.0",
"typescript": "~5.6.2",
"typescript-eslint": "^8.11.0",
"vite": "^5.4.9"
}
}
Binary file added javascript/react-oidc/public/favicon.ico
Binary file not shown.
1 change: 1 addition & 0 deletions javascript/react-oidc/public/vite.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
49 changes: 49 additions & 0 deletions javascript/react-oidc/src/App.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
/*
* App.css
*
* Copyright (c) 2026 Ping Identity Corporation. All rights reserved.
* This software may be modified and distributed under the terms
* of the MIT license. See the LICENSE file for details.
*/
#root {
max-width: 750px;
margin: 0 auto;
padding: 2rem;
text-align: center;
}

.logo {
height: 6em;
padding: 1.5em;
will-change: filter;
transition: filter 300ms;
}
.logo:hover {
filter: drop-shadow(0 0 2em #646cffaa);
}
.logo.react:hover {
filter: drop-shadow(0 0 2em #61dafbaa);
}

@keyframes logo-spin {
from {
transform: rotate(0deg);
}
to {
transform: rotate(360deg);
}
}

@media (prefers-reduced-motion: no-preference) {
a:nth-of-type(2) .logo {
animation: logo-spin infinite 20s linear;
}
}

.form {
padding: 2em;
}

.read-the-docs {
color: #888;
}
58 changes: 58 additions & 0 deletions javascript/react-oidc/src/App.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
/*
* App.tsx
*
* Copyright (c) 2026 Ping Identity Corporation. All rights reserved.
* This software may be modified and distributed under the terms
* of the MIT license. See the LICENSE file for details.
*/
import reactLogo from './assets/react.svg';
import pingLogo from './assets/ping-logo-square-color.svg';
import './App.css';
import Form from './components/Form';

function App() {
return (
<>
<div>
<a href="https://vite.dev" target="_blank">
<img src={pingLogo} className="logo" alt="Ping logo" />
</a>
<a href="https://react.dev" target="_blank">
<img src={reactLogo} className="logo react" alt="React logo" />
</a>
</div>

<h1>
Protect with Ping
<br />
Develop with React.js
</h1>

<p>
Learn how to develop a Ping-protected centralized login web app with the{' '}
<a href="https://reactjs.org/">React.js</a> library and our{' '}
<a href="https://github.com/ForgeRock/ping-javascript-sdk/">JavaScript SDK</a>.
</p>

<Form/>

<div className="read-the-docs">
<h2>About this project</h2>
<p>
The purpose of this sample web app is to demonstrate how the Ping JavaScript SDK is
implemented within a fully-functional application using a popular framework. The source
code for{' '}
<a href="https://github.com/ForgeRock/sdk-sample-apps/tree/main/javascript/react-oidc">
this project can be found on Github
</a>{' '}
and run locally for experimentation. For more on our SDKs,{' '}
<a href="https://docs.pingidentity.com/sdks/latest/index.html">
you can find our official SDK documentation here.
</a>
</p>
</div>
</>
);
}

export default App;
Loading
Loading