Comment Post Options
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎Jun 05, 2024 08:16 PM
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:
â—‹ 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
Comment Post Options
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎Jun 05, 2024 09:43 PM
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
