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:
Sergio
2022-03-25 10:41:53 -06:00
committed by GitHub
parent b9aa440be3
commit 5774dd8885
2 changed files with 5 additions and 3 deletions

View File

@@ -24,6 +24,7 @@ export async function supabaseApiRequest(this: IExecuteFunctions | IExecuteSingl
const options: OptionsWithUri = {
headers: {
apikey: credentials.serviceRole,
Authorization: 'Bearer ' + credentials.serviceRole,
Prefer: 'return=representation',
},
method,
@@ -296,7 +297,7 @@ export const buildGetQuery = (obj: IDataObject, value: IDataObject) => {
return Object.assign(obj, { [`${value.keyName}`]: `eq.${value.keyValue}` });
};
export async function validateCrendentials(
export async function validateCredentials(
this: ICredentialTestFunctions,
decryptedCredentials: ICredentialDataDecryptedObject): Promise<any> { // tslint:disable-line:no-any
@@ -309,6 +310,7 @@ export async function validateCrendentials(
const options: OptionsWithUri = {
headers: {
apikey: serviceRole,
Authorization: 'Bearer ' + serviceRole,
},
method: 'GET',
uri: `${credentials.host}/rest/v1/`,