added entrypoint param to fxa auth request
This commit is contained in:
parent
122867b926
commit
cc9a5d112a
11
app/user.js
11
app/user.js
|
@ -94,10 +94,12 @@ export default class User {
|
||||||
return this.loggedIn ? hashId(this.storage.id) : hashId(anonId);
|
return this.loggedIn ? hashId(this.storage.id) : hashId(anonId);
|
||||||
}
|
}
|
||||||
|
|
||||||
async startAuthFlow(source, utms = {}) {
|
async startAuthFlow(trigger, utms = {}) {
|
||||||
|
this.utms = utms;
|
||||||
|
this.trigger = trigger;
|
||||||
try {
|
try {
|
||||||
const params = new URLSearchParams({
|
const params = new URLSearchParams({
|
||||||
entrypoint: `send-${source}`,
|
entrypoint: `send-${trigger}`,
|
||||||
form_type: 'email',
|
form_type: 'email',
|
||||||
utm_source: utms.source || 'send',
|
utm_source: utms.source || 'send',
|
||||||
utm_campaign: utms.campaign || 'none'
|
utm_campaign: utms.campaign || 'none'
|
||||||
|
@ -111,12 +113,10 @@ export default class User {
|
||||||
const { flowId, flowBeginTime } = await res.json();
|
const { flowId, flowBeginTime } = await res.json();
|
||||||
this.flowId = flowId;
|
this.flowId = flowId;
|
||||||
this.flowBeginTime = flowBeginTime;
|
this.flowBeginTime = flowBeginTime;
|
||||||
this.utms = utms;
|
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
console.error(e);
|
console.error(e);
|
||||||
this.flowId = null;
|
this.flowId = null;
|
||||||
this.flowBeginTime = null;
|
this.flowBeginTime = null;
|
||||||
this.utms = null;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -142,6 +142,9 @@ export default class User {
|
||||||
options.flow_id = this.flowId;
|
options.flow_id = this.flowId;
|
||||||
options.flow_begin_time = this.flowBeginTime;
|
options.flow_begin_time = this.flowBeginTime;
|
||||||
}
|
}
|
||||||
|
if (this.trigger) {
|
||||||
|
options.endpoint = `send-${this.trigger}`;
|
||||||
|
}
|
||||||
if (this.utms) {
|
if (this.utms) {
|
||||||
options.utm_campaign = this.utms.campaign || 'none';
|
options.utm_campaign = this.utms.campaign || 'none';
|
||||||
options.utm_content = this.utms.content || 'none';
|
options.utm_content = this.utms.content || 'none';
|
||||||
|
|
Loading…
Reference in New Issue