Skip to content

Latest commit

 

History

History
87 lines (77 loc) · 3.67 KB

irs-super-user.md

File metadata and controls

87 lines (77 loc) · 3.67 KB

Testing API v2 with the IRS Superuser

Getting Started

You will only have to follow these steps once per environment. If you have already set up your IRS test user in the desired environment, proceed to Generating an API Token for Your IRS Test User.

  1. Install the oathtool utility:
    brew install oath-toolkit
  2. Setup the environment switcher with a .env file for the desired environment.
    1. Be sure to populate the IRS_SUPERUSER_EMAIL value like so:
      IRS_SUPERUSER_EMAIL="[email protected]"
    2. Refer to the example if you are not sure where to put this value.
  3. Use the environment switcher to point your local session to the desired environment:
    . scripts/env/set-env.zsh myenv
  4. Create a user in the desired environment's IRS Cognito pool:
    aws cognito-idp admin-create-user \
     --user-pool-id "$COGNITO_IRS_USER_POOL" \
     --username "$IRS_SUPERUSER_EMAIL" \
     --temporary-password "$DEFAULT_ACCOUNT_PASS" \
     --user-attributes Name="name",Value="${IRS_SUPERUSER_EMAIL}" Name="custom:role",Value="irsSuperuser"
  5. Run the irs-super-user.ts script to enroll your IRS test user in MFA:
    npx ts-node --transpile-only scripts/irs-super-user.ts
  6. Find your IRS test user's MFA secret in the script's output and use it to populate the IRS_SUPERUSER_MFA_SECRET value in the .env file you edited on step 2. Save the file before continuing.
  7. In a separate shell session:
    1. Enter the ef-cms directory
    2. Point this shell session to the desired environment:
      . scripts/env/set-env.zsh myenv
    3. Use oathtool to generate your MFA code:
      oathtool -b --totp "$IRS_SUPERUSER_MFA_SECRET"
  8. Back in the first shell session, enter the MFA code you just generated. This enrolls your test user in MFA.
  9. You will now be asked for a second MFA code. Run oathtool again in the second shell session to generate the code, then paste it into the first session. This verifies the MFA enrollment.

Generating an API Token for Your IRS Test User

  1. Open two new shell sessions, switch to the ef-cms directory in both, and point both sessions to the desired environment:
    . scripts/env/set-env.zsh myenv
  2. In the first shell session, run the irs-super-user.ts script:
    npx ts-node --transpile-only scripts/irs-super-user.ts
  3. In the second shell session, use oathtool to generate your MFA code:
    oathtool -b --totp "$IRS_SUPERUSER_MFA_SECRET"
  4. Back in the first shell session, enter the MFA code you just generated.
  5. Copy the IdToken value from the output to your clipboard.

Testing API v2 with Your IRS Test User

Be sure to replace ID_TOKEN in the authorization header with a valid API token.

Reconciliation Report

Replace today with a specific date if nothing has been served today.

GET https://api.myenv/v2/reconciliation-report/today
Authorization: Bearer ID_TOKEN

Case Detail

Replace DOCKET_NUMBER with the desired docket number.

GET https://api.myenv/v2/cases/DOCKET_NUMBER
Authorization: Bearer ID_TOKEN

Docket Entry Download

Replace DOCKET_NUMBER with the desired docket number, and replace DOCKET_ENTRY_ID with a valid docket entry id belonging to the desired case.

GET https://api.myenv/v2/cases/DOCKET_NUMBER/entries/DOCKET_ENTRY_ID/document-download-url
Authorization: Bearer ID_TOKEN