From edad21929bab277b93764bbccb2b1b2084e62035 Mon Sep 17 00:00:00 2001 From: Alex Hoffer Date: Wed, 12 Jul 2023 15:04:01 -0700 Subject: [PATCH 1/2] docker updates --- .env.template | 8 ++++++-- README.md | 7 +++++-- ngrok/ngrok.yml | 4 +++- 3 files changed, 14 insertions(+), 5 deletions(-) diff --git a/.env.template b/.env.template index 780cc90..8bf6c35 100644 --- a/.env.template +++ b/.env.template @@ -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 @@ -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= \ No newline at end of file +PLAID_SANDBOX_REDIRECT_URI=http://localhost:3002/oauth-link +PLAID_DEVELOPMENT_REDIRECT_URI= diff --git a/README.md b/README.md index 9a8b105..5aede2c 100644 --- a/README.md +++ b/README.md @@ -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 @@ -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. diff --git a/ngrok/ngrok.yml b/ngrok/ngrok.yml index b72afe0..a216ec9 100644 --- a/ngrok/ngrok.yml +++ b/ngrok/ngrok.yml @@ -1 +1,3 @@ -web_addr: 0.0.0.0:4040 \ No newline at end of file +web_addr: 0.0.0.0:4040 +# Fill this in with your authtoken from https://dashboard.ngrok.com/get-started/your-authtoken +authtoken: From 2a29ca9ae2146260c55a56490931ba8507e33fbe Mon Sep 17 00:00:00 2001 From: Alex Hoffer Date: Wed, 12 Jul 2023 15:09:54 -0700 Subject: [PATCH 2/2] docs improvements --- Makefile | 16 ++++++++-------- README.md | 8 +++----- 2 files changed, 11 insertions(+), 13 deletions(-) diff --git a/Makefile b/Makefile index 50f4059..bdf0821 100644 --- a/Makefile +++ b/Makefile @@ -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 diff --git a/README.md b/README.md index 4770f6e..0abda10 100644 --- a/README.md +++ b/README.md @@ -89,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