cognito_example_client_app
This repository contains client applications that can be used to test an app client in the BC Gov Cognito SSO Shared Service.
Next-App
An example Next.js application to connect to Cognito App client without 3rd party library or wrapper.
- located in examples/next-app directory.
How to run
- Local development environment w/o Docker
- Go to
examples/next-app
. - Copy
.env.example
to.env.local
, - Set environment variables in
.env.local
. - Run the development server:
yarn install
yarn dev
- Docker based local development environment
- Go to
examples/next-app
- Copy
.env.example
to.env
, - Set environment variables in
.env
. - Run the
docker-compose
file:
docker-compose up
- Docker Compose sources environment variables from a
.env
file located next to the docker-compose.yml file.
Next-App-JWT
An example Next.js application to connect to Cognito App client using JWT (JSON Web Token).
- located in examples/next-app-jwt directory.
- the setup process is the same as
Next-App
.
Next-App-Openid
An example Next.js application to connect to Cognito App client using openid-client
, which is a server side OpenID Relying Party.
- located in examples/next-app-openid directory.
- the setup process is the same as
Next-App
.
React-App-Amplify
This is an example React.js application to connect to Cognito App client on client side using Amplify library.
- located in examples/react-app-amplify directory.
How to run
- Local development environment w/o Docker
- Go to
examples/react-app-amplify
. - Copy
src/aws-exports.js.sample
tosrc/aws-exports.js
, - Set values in
src/aws-exports.js
. - Run the development server:
yarn install
yarn start
- Docker based local development environment
- Go to
examples/react-app-amplify
. - Copy
src/aws-exports.js.sample
tosrc/aws-exports.js
, - Set values in
src/aws-exports.js
. - Run the
docker-compose
file:
docker-compose up
Next-App-PKCE
An example React.js application to connect to Cognito App client respecting OAuth 2.0 Authorization Code with PKCE Flow.
- located in examples/next-app-pkce directory.
- the setup process is the same as
React-App-Amplify
.
How to Contribute
If you would like to contribute, please see our CONTRIBUTING guidelines.
Please note that this project is released with a Contributor Code of Conduct. By participating in this project you agree to abide by its terms.