Skip to content

Commit 5c609ff

Browse files
authored
Merge pull request #19979 from mozilla/FXA-12993
PART 1: feat(auth): Add backend APIs needed to move off GraphQL
2 parents 0226462 + bdc7bfc commit 5c609ff

11 files changed

Lines changed: 557 additions & 44 deletions

File tree

packages/fxa-auth-client/lib/client.ts

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1176,6 +1176,18 @@ export default class AuthClient {
11761176
);
11771177
}
11781178

1179+
async emailBounceStatus(
1180+
email: string,
1181+
headers?: Headers
1182+
): Promise<{ hasHardBounce: boolean }> {
1183+
return this.request(
1184+
'POST',
1185+
'/account/email_bounce_status',
1186+
{ email },
1187+
headers
1188+
);
1189+
}
1190+
11791191
async accountProfile(sessionToken: hexstring, headers?: Headers) {
11801192
return this.sessionGet('/account/profile', sessionToken, headers);
11811193
}
@@ -1184,6 +1196,19 @@ export default class AuthClient {
11841196
return this.sessionGet('/account', sessionToken, headers);
11851197
}
11861198

1199+
async metricsOpt(
1200+
sessionToken: hexstring,
1201+
state: 'in' | 'out',
1202+
headers?: Headers
1203+
): Promise<{}> {
1204+
return this.sessionPost(
1205+
'/account/metrics_opt',
1206+
sessionToken,
1207+
{ state },
1208+
headers
1209+
);
1210+
}
1211+
11871212
async sessionDestroy(
11881213
sessionToken: hexstring,
11891214
options: {

packages/fxa-auth-server/config/dev.json

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,11 @@
2323
"subscriptionTermsUrl": "https://www.mozilla.org/about/legal/terms/subscription-services",
2424
"subscriptionSettingsUrl": "http://localhost:3035/",
2525
"user": "local",
26-
"password": "local"
26+
"password": "local",
27+
"bounces": {
28+
"enabled": true,
29+
"aliasCheckEnabled": true
30+
}
2731
},
2832
"snsTopicArn": "arn:aws:sns:us-east-1:100010001000:fxa-account-change-dev",
2933
"snsTopicEndpoint": "http://localhost:4100/",

packages/fxa-auth-server/config/rate-limit-rules.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ loadAccountFailed : ip : 50 : 24 hou
2626
#
2727
accountCreate : ip : 100 : 24 hours : 24 hours : block
2828
accountStatusCheck : ip : 100 : 15 minute : 15 minute : block
29+
emailBounceStatusCheck : ip : 100 : 15 minute : 15 minute : block
2930
recoveryKeyExists : ip : 100 : 15 minute : 15 minute : block
3031
getCredentialsStatus : ip : 100 : 15 minute : 15 minute : block
3132

packages/fxa-auth-server/docs/swagger/account-api.ts

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,14 @@ const ACCOUNT_STATUS_POST = {
109109
],
110110
};
111111

112+
const ACCOUNT_EMAIL_BOUNCE_STATUS_POST = {
113+
...TAGS_ACCOUNT,
114+
description: '/account/email_bounce_status',
115+
notes: [
116+
'Checks if there are any hard (permanent) email bounces recorded for the provided email address. Used during signup confirmation to detect if verification emails are bouncing.',
117+
],
118+
};
119+
112120
const ACCOUNT_PROFILE_GET = {
113121
...TAGS_ACCOUNT,
114122
description: '/account/profile',
@@ -310,12 +318,24 @@ const ACCOUNT_STUB_POST = {
310318
description: '/account/stub',
311319
};
312320

321+
const ACCOUNT_METRICS_OPT_POST = {
322+
...TAGS_ACCOUNT,
323+
description: '/account/metrics_opt',
324+
notes: [
325+
dedent`
326+
Set the metrics opt-in or opt-out state for the account. Notifies relying parties of the profile data change.
327+
`,
328+
],
329+
};
330+
313331
const API_DOCS = {
314332
ACCOUNT_CREATE_POST,
315333
ACCOUNT_DESTROY_POST,
334+
ACCOUNT_EMAIL_BOUNCE_STATUS_POST,
316335
ACCOUNT_FINISH_SETUP_POST,
317336
ACCOUNT_KEYS_GET,
318337
ACCOUNT_LOGIN_POST,
338+
ACCOUNT_METRICS_OPT_POST,
319339
ACCOUNT_PROFILE_GET,
320340
ACCOUNT_RESET_POST,
321341
ACCOUNT_CREDENTIALS_STATUS,

0 commit comments

Comments
 (0)