Skip to content

Commit 5c214a0

Browse files
committed
Merge main into branch
2 parents 56a9f27 + ebdc309 commit 5c214a0

File tree

3 files changed

+17
-9
lines changed

3 files changed

+17
-9
lines changed

README.md

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,21 @@
1-
# Formstack Submitter
1+
# Formstack Submitter
22

3-
This lambda receives HTTP POST requests from Frontend and MAPI and sends them on to the Formstack database.
3+
This lambda receives HTTP POST requests from Frontend and MAPI and sends them on to the Formstack database.
44

55
The data comes from reader callout forms submitted on the user interface.
66

7-
# To test locally
7+
## To test locally
88

99
Run the local file: `npm run runlocal`
10-
Ensure to put environment variables `formstack_url` and `oauth_token` on terminal before running above command.
10+
Ensure to put environment variables `FORMSTACK_URL` and `API_TOKEN` on terminal before running above command.
1111
Please refer stage CODE in content-api stack.
1212

13+
## Formstack integration issues
1314

15+
If the integration with Formstack is broken, it’s likely due to an expired or deactivated access token. Access tokens are linked to users and can be deactivated when users lose access to their accounts.
16+
17+
To resolve this, contact Central Production for Admin access to the Formstack account. The simplest solution is to generate a new access token by creating a new API Application.
18+
19+
Then, update the Cloudformation stack entry.
20+
21+
This repo uses the same credentials that https://github.com/guardian/targeting uses for authenticating with Formstack.

cloudformation.yaml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
AWSTemplateFormatVersion: '2010-09-09'
22
Transform: 'AWS::Serverless-2016-10-31'
3-
Description: Forwards POST requests from Frontend & MAPI to our Formstack account
3+
Description: Forwards POST requests from Frontend & MAPI to our Formstack account
44

55
Parameters:
66
Stack:
77
Description: Stack name
88
Type: String
9-
Default: content-api
9+
Default: content-api
1010
App:
1111
Description: Application name
1212
Type: String
@@ -21,7 +21,7 @@ Parameters:
2121
Description: Bucket to copy files to
2222
Type: String
2323
Default: content-api-dist
24-
OAuthToken:
24+
ApiToken:
2525
Description: Token used for Formstack authentication
2626
Type: String
2727
FormStackUrl:
@@ -42,7 +42,7 @@ Resources:
4242
Environment:
4343
Variables:
4444
Stage: !Ref Stage
45-
OAUTH_TOKEN: !Ref OAuthToken
45+
API_TOKEN: !Ref ApiToken
4646
FORMSTACK_URL: !Ref FormStackUrl
4747
CodeUri:
4848
Bucket: !Ref DeployBucket

src/submitter.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ const reqHeaders = {
88
headers: {
99
"Content-Type": "application/json",
1010
Accept: "application/json",
11-
Authorization: `Bearer ${process.env.OAUTH_TOKEN}`,
11+
Authorization: `Bearer ${process.env.API_TOKEN}`,
1212
},
1313
};
1414

0 commit comments

Comments
 (0)