Help

Re: Authentication for Personal Access Tokens not working!

737 0
cancel
Showing results for 
Search instead for 
Did you mean: 
Jay_P
7 - App Architect
7 - App Architect
const Airtable = require('airtable');
 
const airtable = new Airtable({
apiKey: 'patMH--changed--FEQXBB4',
});

 

// Replace with your Airtable base ID
const baseId = 'appM0aa--changed--DFmhzwJv6w';

 

// Replace with the table name you want to access
const tableName = 'home_first';



airtable.base(baseId)(tableName)
.select({
filterByFormula: '{RECORD_ID() <= 5}', // Filter to get the first 5 records
maxRecords: 5, // Limit to 5 records
})
.firstPage((err, records) => {
if (err) { console.error(err); return; }
records.forEach((record) => {
console.log(record.fields); // Access record data using record.fields object
});
});
 
 I keep getting the following error: 
Jay_P_0-1717632023714.png

 

○ node one.js
AirtableError {
error: 'AUTHENTICATION_REQUIRED',
message: 'You should provide valid api key to perform this operation',
statusCode: 401
}

Yes, I have given full permission in the scope to access the base and the read and write permissions. 

1 Reply 1

Long shot, but maybe you could double check the table name / ID or any other params such as app or view name / ID?

I get a 403 "Not Authorized" error when the table name's incorrect and so I'm wondering if you might be getting a 401 for a similar issue since you've already double checked your permissions