Skip to content

FusionAuth/fusionauth-example-api-consents-platform

Repository files navigation

Example API Consents Application

This repo holds two example JavaScript applications.

  • MoneyScope, a financial analysis tool
  • Changebank APIs

This application will use an OAuth Authorization Code Grant workflow to log a user in, request needed OAuth Scopes and get them access and refresh tokens. The access token will be used to make a request against the Changebank APIs to find the user's balance.

This application was built to illustrate the API Consents Platform use case.

Project Contents

The docker-compose.yml file and the kickstart directory are used to start and configure a local FusionAuth server.

The moneyscope-application directory contains a fully working version of the MoneyScope application.

The changebank-apis directory contains a fully working version of the Changebank APIs.

create-application is a directory that contains a FusionAuth SDK script to create the third-party application instead of using Kickstart. It can safely be ignored.

Project Dependencies

Running FusionAuth

First, edit kickstart/kickstart.json and add a valid Essentials or Enterprise license key. Look for the line "licenseId": "LICENSE ID", and replace LICENSE ID with a valid key.

To run FusionAuth, just stand up the docker containers using docker compose.

docker compose up

This will start a PostgreSQL database, OpenSearch service, and the FusionAuth server.

Running the Apps

For the MoneyScope application:

Copy the env.sample file to .env and edit it if needed. (For example, if you are using a remote FusionAuth instance.)

cd moneyscope-application
npm install
npm run dev

In a separate terminal window, to start the Changebank APIs:

Copy the env.sample file to .env and edit it if needed. (For example, if you are using a remote FusionAuth instance.)

cd changebank-apis
npm install
npm run dev

Testing Out the Apps

Visit the local webserver at http://localhost:8080/ and sign in using the credentials:

Accept the scopes and you'll be logged into the MoneyScope application.

You can modify the bank balance by changing the APIs in the changebank-apis/routes/index.js file.

About

An example application showing how to use third-party applications and custom scopes with FusionAuth

Topics

Resources

License

Stars

Watchers

Forks

Contributors 2

  •  
  •