OpenID Connect (OIDC) client with React and typescript
-
This is sample application, full credit to Jan Škoruba
-
It contains oidc-client-js and
React
withTypescript
. -
The application is based on
create-react-app
- Create React App -
You will need access to the MATTR Platform and have configured the OIDC Bridge extension as a Verifier and setup a Client. See our Learn site for details.
The sample app is ready to be installed locally for trying out the connection to MATTR Identity Agent Platform.
On your tenant, use the OIDC Bridge to create a Verifier and setup a Client The Client will need to be configured with this:
{
"name": "Verify React OIDC Sample App",
"redirectUris": [
"http://localhost:3000/signin-callback.html"
],
"responseTypes": [
"code"
],
"grantTypes": [
"authorization_code"
],
"tokenEndpointAuthMethod": "none",
"idTokenSignedResponseAlg": "ES256",
"applicationType": "native",
"logoUri": "https://learn.mattr.global/MATTR-logo_light-full.svg"
}
Use the id
value as the client-id
value.
git clone https://github.com/mattrglobal/sample-apps
- Install dependencies
cd react-oidc-client
yarn install
Rename the .env-template
file to .env
and add your variables
REACT_APP_STSAUTHORITY=https://<your-tenant>.vii.mattr.global/oidc/v1/verifiers/<verifier-id>
REACT_APP_CLIENTID=<client-id>
REACT_APP_CLIENTROOT=https://localhost:3000/
REACT_APP_CLIENTSCOPE=openid_credential_presentation
yarn start
- start the web server
Copyright © MATTR Limited. Some rights reserved.
“MATTR” is a trademark of MATTR Limited, registered in New Zealand and other countries.