mirror of
https://github.com/n8n-io/n8n.git
synced 2025-03-05 20:50:17 -08:00
fix(bitwarden): support European Cloud-Hosted instances (#13315)
This commit is contained in:
parent
8790a0df3d
commit
51b55a4cd1
|
@ -51,5 +51,26 @@ export class BitwardenApi implements ICredentialType {
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
displayName: 'Server Geographies',
|
||||||
|
name: 'serverLocation',
|
||||||
|
type: 'options',
|
||||||
|
default: 'bitwarden.com',
|
||||||
|
options: [
|
||||||
|
{
|
||||||
|
name: 'United States',
|
||||||
|
value: 'bitwarden.com',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: 'European Union',
|
||||||
|
value: 'bitwarden.eu',
|
||||||
|
},
|
||||||
|
],
|
||||||
|
displayOptions: {
|
||||||
|
show: {
|
||||||
|
environment: ['cloudHosted'],
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
|
@ -13,10 +13,10 @@ import { NodeApiError } from 'n8n-workflow';
|
||||||
* Return the access token URL based on the user's environment.
|
* Return the access token URL based on the user's environment.
|
||||||
*/
|
*/
|
||||||
async function getTokenUrl(this: IExecuteFunctions | ILoadOptionsFunctions) {
|
async function getTokenUrl(this: IExecuteFunctions | ILoadOptionsFunctions) {
|
||||||
const { environment, domain } = await this.getCredentials('bitwardenApi');
|
const { environment, domain, serverLocation } = await this.getCredentials('bitwardenApi');
|
||||||
|
|
||||||
return environment === 'cloudHosted'
|
return environment === 'cloudHosted'
|
||||||
? 'https://identity.bitwarden.com/connect/token'
|
? `https://identity.${serverLocation}/connect/token`
|
||||||
: `${domain}/identity/connect/token`;
|
: `${domain}/identity/connect/token`;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -24,9 +24,9 @@ async function getTokenUrl(this: IExecuteFunctions | ILoadOptionsFunctions) {
|
||||||
* Return the base API URL based on the user's environment.
|
* Return the base API URL based on the user's environment.
|
||||||
*/
|
*/
|
||||||
async function getBaseUrl(this: IExecuteFunctions | ILoadOptionsFunctions) {
|
async function getBaseUrl(this: IExecuteFunctions | ILoadOptionsFunctions) {
|
||||||
const { environment, domain } = await this.getCredentials('bitwardenApi');
|
const { environment, domain, serverLocation } = await this.getCredentials('bitwardenApi');
|
||||||
|
|
||||||
return environment === 'cloudHosted' ? 'https://api.bitwarden.com' : `${domain}/api`;
|
return environment === 'cloudHosted' ? `https://api.${serverLocation}` : `${domain}/api`;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Reference in a new issue