mirror of
https://github.com/n8n-io/n8n.git
synced 2025-03-05 20:50:17 -08:00
fix(Supabase Node): Send token also via Authorization Bearer (#2814)
Send Authorization Bearer in headers Fix typo in validateCredentials function
This commit is contained in:
parent
b9aa440be3
commit
5774dd8885
|
@ -24,6 +24,7 @@ export async function supabaseApiRequest(this: IExecuteFunctions | IExecuteSingl
|
||||||
const options: OptionsWithUri = {
|
const options: OptionsWithUri = {
|
||||||
headers: {
|
headers: {
|
||||||
apikey: credentials.serviceRole,
|
apikey: credentials.serviceRole,
|
||||||
|
Authorization: 'Bearer ' + credentials.serviceRole,
|
||||||
Prefer: 'return=representation',
|
Prefer: 'return=representation',
|
||||||
},
|
},
|
||||||
method,
|
method,
|
||||||
|
@ -296,7 +297,7 @@ export const buildGetQuery = (obj: IDataObject, value: IDataObject) => {
|
||||||
return Object.assign(obj, { [`${value.keyName}`]: `eq.${value.keyValue}` });
|
return Object.assign(obj, { [`${value.keyName}`]: `eq.${value.keyValue}` });
|
||||||
};
|
};
|
||||||
|
|
||||||
export async function validateCrendentials(
|
export async function validateCredentials(
|
||||||
this: ICredentialTestFunctions,
|
this: ICredentialTestFunctions,
|
||||||
decryptedCredentials: ICredentialDataDecryptedObject): Promise<any> { // tslint:disable-line:no-any
|
decryptedCredentials: ICredentialDataDecryptedObject): Promise<any> { // tslint:disable-line:no-any
|
||||||
|
|
||||||
|
@ -309,6 +310,7 @@ export async function validateCrendentials(
|
||||||
const options: OptionsWithUri = {
|
const options: OptionsWithUri = {
|
||||||
headers: {
|
headers: {
|
||||||
apikey: serviceRole,
|
apikey: serviceRole,
|
||||||
|
Authorization: 'Bearer ' + serviceRole,
|
||||||
},
|
},
|
||||||
method: 'GET',
|
method: 'GET',
|
||||||
uri: `${credentials.host}/rest/v1/`,
|
uri: `${credentials.host}/rest/v1/`,
|
||||||
|
|
|
@ -21,7 +21,7 @@ import {
|
||||||
buildOrQuery,
|
buildOrQuery,
|
||||||
buildQuery,
|
buildQuery,
|
||||||
supabaseApiRequest,
|
supabaseApiRequest,
|
||||||
validateCrendentials,
|
validateCredentials,
|
||||||
} from './GenericFunctions';
|
} from './GenericFunctions';
|
||||||
|
|
||||||
import {
|
import {
|
||||||
|
@ -106,7 +106,7 @@ export class Supabase implements INodeType {
|
||||||
credentialTest: {
|
credentialTest: {
|
||||||
async supabaseApiCredentialTest(this: ICredentialTestFunctions, credential: ICredentialsDecrypted): Promise<INodeCredentialTestResult> {
|
async supabaseApiCredentialTest(this: ICredentialTestFunctions, credential: ICredentialsDecrypted): Promise<INodeCredentialTestResult> {
|
||||||
try {
|
try {
|
||||||
await validateCrendentials.call(this, credential.data as ICredentialDataDecryptedObject);
|
await validateCredentials.call(this, credential.data as ICredentialDataDecryptedObject);
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
return {
|
return {
|
||||||
status: 'Error',
|
status: 'Error',
|
||||||
|
|
Loading…
Reference in a new issue