Skip to content
Open
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
8 changes: 6 additions & 2 deletions .env.template
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,10 @@ PLAID_SECRET_SANDBOX=

PLAID_ENV=sandbox

# IMPORTANT: Also update ngrok.yml in the /ngrok directory to add your authtoken

# (Optional) Redirect URI settings section
# Only required for OAuth redirect URI testing (not common on desktop):
# Sandbox Mode:
# Set the PLAID_SANDBOX_REDIRECT_URI below to 'http://localhost:3002/oauth-link'.
# The OAuth redirect flow requires an endpoint on the developer's website
Expand All @@ -28,5 +32,5 @@ PLAID_ENV=sandbox
# Learn how to do this under "Mobile Device Viewport Mode" here:
# https://developer.chrome.com/docs/devtools/device-mode/

PLAID_SANDBOX_REDIRECT_URI=
PLAID_DEVELOPMENT_REDIRECT_URI=
PLAID_SANDBOX_REDIRECT_URI=http://localhost:3002/oauth-link
PLAID_DEVELOPMENT_REDIRECT_URI=
16 changes: 8 additions & 8 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -29,36 +29,36 @@ help:
## Start the services
start: $(envfile) $(clear_db_after_schema_change)
@echo "Pulling images from Docker Hub (this may take a few minutes)"
docker-compose pull
docker compose pull
@echo "Starting Docker services"
docker-compose up --build --detach
docker compose up --build --detach
./wait-for-client.sh

## Start the services without webhooks
start-no-webhooks: $(envfile) $(clear_db_after_schema_change)
@echo "Pulling images from Docker Hub (this may take a few minutes)"
docker-compose pull
docker compose pull
@echo "Starting Docker services"
docker-compose up --detach client
docker compose up --detach client
./wait-for-client.sh

## Start the services in debug mode
debug: $(envfile) $(clear_db_after_schema_change)
@echo "Starting services (this may take a few minutes if there are any changes)"
docker-compose -f docker-compose.yml -f docker-compose.debug.yml up --build --detach
docker compose -f docker-compose.yml -f docker-compose.debug.yml up --build --detach
./wait-for-client.sh

## Start an interactive psql session (services must running)
sql:
docker-compose exec db psql -U postgres
docker compose exec db psql -U postgres

## Show the service logs (services must be running)
logs:
docker-compose logs --follow
docker compose logs --follow

## Stop the services
stop:
docker-compose down
docker compose down
docker volume rm $(current_dir)_{client,server}_node_modules 2>/dev/null || true

## Clear the sandbox and development databases
Expand Down
15 changes: 8 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ Plaid Pattern apps are provided for illustrative purposes and are not meant to b

- [Docker][docker] Version 2.0.0.3 (31259) or higher, installed, running, and signed in. If you're on **Windows**, check out [this link][wsl] to get set up in WSL.
- [Plaid API keys][plaid-keys] - [sign up][plaid-signup] for a free Sandbox account if you don't already have one
- An [ngrok authtoken](https://dashboard.ngrok.com/get-started/your-authtoken). If you don't already have an ngrok account, you can [sign up for free](https://dashboard.ngrok.com/signup).

## Getting Started

Expand All @@ -23,9 +24,11 @@ Note: We recommend running these commands in a unix terminal. Windows users can
```shell
cp .env.template .env
```
1. Update the `.env` file with your [Plaid API keys][plaid-keys] and, if you are testing OAuth, OAuth redirect uri (in sandbox this is `http://localhost:3002/oauth-link`).
1. Update the `.env` file with your [Plaid API keys][plaid-keys] and, if you are testing OAuth, OAuth redirect uri (in sandbox this is `http://localhost:3002/oauth-link`).

1. If you have entered an OAuth redirect uri in the .env file, you will also need to configure an allowed redirect URI for your client ID through the [Plaid developer dashboard](https://dashboard.plaid.com/team/api).
1. Update the `ngrok.yml` file in the ngrok folder with your [ngrok authtoken](https://dashboard.ngrok.com/get-started/your-authtoken).

1. If you have entered an optional OAuth redirect uri in the .env file, you will also need to configure an allowed redirect URI for your client ID through the [Plaid developer dashboard](https://dashboard.plaid.com/team/api).

1. Verify Payment Initiation is enabled for your client ID through the Plaid Developer Dashboard ([Development](https://dashboard.plaid.com/overview/development), [Sandbox](https://dashboard.plaid.com/overview/sandbox) and [Production](https://dashboard.plaid.com/team/products)). If it is not enabled, contact your Plaid Account Executive or Account Manager to enable your client ID for the Payment Initiation product.

Expand Down Expand Up @@ -86,13 +89,11 @@ For webhooks to work, the server must be publicly accessible on the internet. Fo

### Testing OAuth

A redirect_uri parameter is included in the linkTokenCreate call and set in this sample app to the PLAID_SANDBOX_REDIRECT_URI you have set in the .env file (`http://localhost:3002/oauth-link`). This is the page that the user will be redirected to upon completion of the OAuth flow at their OAuth institution. You will also need to configure `http://localhost:3002/oauth-link` as an allowed redirect URI for your client ID through the [Plaid developer dashboard](https://dashboard.plaid.com/team/api).
A redirect_uri parameter is included in the linkTokenCreate call and set in this sample app to the PLAID_SANDBOX_REDIRECT_URI you have set in the .env file (`http://localhost:3002/oauth-link`). This is the page that the user will be redirected to upon completion of the OAuth flow at their OAuth institution when using a non-popup OAuth flow, such as when using mobile webviews. To test this flow, you will also need to configure `http://localhost:3002/oauth-link` as an allowed redirect URI for your client ID through the [Plaid developer dashboard](https://dashboard.plaid.com/team/api).

To test the OAuth flow you may use the Chrome browser to simulate a mobile device.
Learn how to do this under "Mobile Device Viewport Mode" here:
https://developer.chrome.com/docs/devtools/device-mode/
For more details on testing OAuth, see [Testing OAuth](https://plaid.com/docs/link/oauth/#testing-oauth).

If you want to test OAuth in development, you need to use https and set `PLAID_REDIRECT_URI=https://localhost:3002/oauth-link` in `.env`. In order to run your localhost on https, you will need to create a self-signed certificate and add it to the client root folder. MacOS users can use the following instructions to do this. Note that self-signed certificates should be used for testing purposes only, never for actual deployments. Windows users can use [these instructions below](#windows-instructions-for-using-https-with-localhost).
If you want to test an OAuth redirect uri in development, you need to use https and set `PLAID_REDIRECT_URI=https://localhost:3002/oauth-link` in `.env`. In order to run your localhost on https, you will need to create a self-signed certificate and add it to the client root folder. MacOS users can use the following instructions to do this. Note that self-signed certificates should be used for testing purposes only, never for actual deployments. Windows users can use [these instructions below](#windows-instructions-for-using-https-with-localhost).

#### MacOS instructions for using https with localhost

Expand Down
4 changes: 3 additions & 1 deletion ngrok/ngrok.yml
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
web_addr: 0.0.0.0:4040
web_addr: 0.0.0.0:4040
# Fill this in with your authtoken from https://dashboard.ngrok.com/get-started/your-authtoken
authtoken: