fix(clients): fall back to env credentials when customer has no per-account creds
This commit is contained in:
@@ -22,7 +22,7 @@ spec:
|
|||||||
fsGroup: 1000
|
fsGroup: 1000
|
||||||
containers:
|
containers:
|
||||||
- name: hermes-mcp
|
- name: hermes-mcp
|
||||||
image: localhost:32000/hermes-mcp@sha256:c3d6ce959184e3fdf0d33ce84547aa0b0092ffdf535da90e09e18e161108ed6a
|
image: localhost:32000/hermes-mcp@sha256:d282f50a2409b322ffbf5a7e10511493e3fcf7346a9fb47ecfac10b8cbe02660
|
||||||
imagePullPolicy: Always
|
imagePullPolicy: Always
|
||||||
securityContext:
|
securityContext:
|
||||||
allowPrivilegeEscalation: false
|
allowPrivilegeEscalation: false
|
||||||
|
|||||||
@@ -22,8 +22,8 @@ async function resolveCreds(
|
|||||||
): Promise<{ accessToken: string; pageId: string }> {
|
): Promise<{ accessToken: string; pageId: string }> {
|
||||||
if (customer) {
|
if (customer) {
|
||||||
const creds = await customer.getCredential<FacebookCredentials>('facebook');
|
const creds = await customer.getCredential<FacebookCredentials>('facebook');
|
||||||
if (!creds) throw new Error('Facebook not connected for this account');
|
if (creds) return { accessToken: creds.accessToken, pageId: creds.pageId };
|
||||||
return { accessToken: creds.accessToken, pageId: creds.pageId };
|
// Fall back to default env credentials when customer has no per-account creds
|
||||||
}
|
}
|
||||||
const account = args.account ?? 'default';
|
const account = args.account ?? 'default';
|
||||||
const accessToken = getEnvToken(account);
|
const accessToken = getEnvToken(account);
|
||||||
|
|||||||
@@ -24,8 +24,8 @@ async function resolveCreds(
|
|||||||
): Promise<{ accessToken: string; businessAccountId: string }> {
|
): Promise<{ accessToken: string; businessAccountId: string }> {
|
||||||
if (customer) {
|
if (customer) {
|
||||||
const creds = await customer.getCredential<InstagramCredentials>('instagram');
|
const creds = await customer.getCredential<InstagramCredentials>('instagram');
|
||||||
if (!creds) throw new Error('Instagram not connected for this account');
|
if (creds) return { accessToken: creds.accessToken, businessAccountId: creds.businessAccountId };
|
||||||
return { accessToken: creds.accessToken, businessAccountId: creds.businessAccountId };
|
// Fall back to default env credentials when customer has no per-account creds
|
||||||
}
|
}
|
||||||
const account = args.account ?? 'default';
|
const account = args.account ?? 'default';
|
||||||
const accessToken = getEnvToken(account);
|
const accessToken = getEnvToken(account);
|
||||||
|
|||||||
Reference in New Issue
Block a user