piece-snapchat-leads 0.0.1 → 0.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/src/lib/auth.d.ts.map +1 -1
- package/src/lib/auth.js +5 -3
- package/src/lib/auth.js.map +1 -1
package/package.json
CHANGED
package/src/lib/auth.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"auth.d.ts","sourceRoot":"","sources":["../../../src/lib/auth.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"auth.d.ts","sourceRoot":"","sources":["../../../src/lib/auth.ts"],"names":[],"mappings":"AAuBA,eAAO,MAAM,iBAAiB,+GAoB5B,CAAC"}
|
package/src/lib/auth.js
CHANGED
|
@@ -9,8 +9,9 @@ Snapchat access tokens live about 1 hour, so this connection uses the
|
|
|
9
9
|
standard OAuth2 flow and Activepieces refreshes the token automatically —
|
|
10
10
|
no token is ever pasted here.
|
|
11
11
|
|
|
12
|
-
1. In Snap Business Manager,
|
|
13
|
-
|
|
12
|
+
1. In Snap Business Manager, create a NEW OAuth app for this connection
|
|
13
|
+
(an existing app's redirect URI cannot be changed — Snap locks it at
|
|
14
|
+
creation). Set the new app's redirect URI to:
|
|
14
15
|
https://activepieces.mediabuyer.tech/redirect
|
|
15
16
|
2. Copy the app's Client ID and Client Secret into the fields below.
|
|
16
17
|
3. Click Connect and authorize as an Organization Admin. The app needs the
|
|
@@ -36,9 +37,10 @@ exports.snapchatLeadsAuth = pieces_framework_1.PieceAuth.OAuth2({
|
|
|
36
37
|
return { valid: true };
|
|
37
38
|
}
|
|
38
39
|
catch (error) {
|
|
40
|
+
const detail = error instanceof Error && error.message !== '' ? error.message : '';
|
|
39
41
|
return {
|
|
40
42
|
valid: false,
|
|
41
|
-
error:
|
|
43
|
+
error: `Invalid Snapchat credentials: could not list ad accounts with this connection. Check that the app is authorized with the snapchat-marketing-api scope.${detail !== '' ? ` Snapchat said: ${detail}` : ''}`,
|
|
42
44
|
};
|
|
43
45
|
}
|
|
44
46
|
}),
|
package/src/lib/auth.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"auth.js","sourceRoot":"","sources":["../../../src/lib/auth.ts"],"names":[],"mappings":";;;;AAAA,qEAAsF;AACtF,qCAA+C;AAE/C,MAAM,SAAS,GAAG
|
|
1
|
+
{"version":3,"file":"auth.js","sourceRoot":"","sources":["../../../src/lib/auth.ts"],"names":[],"mappings":";;;;AAAA,qEAAsF;AACtF,qCAA+C;AAE/C,MAAM,SAAS,GAAG;;;;;;;;;;;;;;;;;;CAkBjB,CAAC;AAEW,QAAA,iBAAiB,GAAG,4BAAS,CAAC,MAAM,CAAC;IAChD,QAAQ,EAAE,IAAI;IACd,WAAW,EAAE,SAAS;IACtB,OAAO,EAAE,sDAAsD;IAC/D,QAAQ,EAAE,yDAAyD;IACnE,KAAK,EAAE,CAAC,wBAAwB,CAAC;IACjC,MAAM,EAAE,MAAM;IACd,mBAAmB,EAAE,4CAAyB,CAAC,IAAI;IACnD,QAAQ,EAAE,KAAiB,EAAE,oDAAZ,EAAE,IAAI,EAAE;QACvB,IAAI,CAAC;YACH,MAAM,4BAAmB,CAAC,cAAc,CAAC,IAAI,CAAC,CAAC;YAC/C,OAAO,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC;QACzB,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,MAAM,MAAM,GAAG,KAAK,YAAY,KAAK,IAAI,KAAK,CAAC,OAAO,KAAK,EAAE,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,CAAC;YACnF,OAAO;gBACL,KAAK,EAAE,KAAK;gBACZ,KAAK,EAAE,yJAAyJ,MAAM,KAAK,EAAE,CAAC,CAAC,CAAC,mBAAmB,MAAM,EAAE,CAAC,CAAC,CAAC,EAAE,EAAE;aACnN,CAAC;QACJ,CAAC;IACH,CAAC,CAAA;CACF,CAAC,CAAC"}
|