Skip to main content

Authentication required

  • June 29, 2020
  • 13 replies
  • 411 views

when i create records,got a reeor about Authentication,the message is:{“error”:{“type”:“AUTHENTICATION_REQUIRED”,“message”:“Authentication required”}}

this is my code and data:

url = “https://api.airtable.com/v0/appjiuXPDkRCdDkhs/Pipeline
h = {
“Authorization”:“keyE5yxxxxxxxxgb0x3”,
“Content-Type”:“application/json”
}
data_list = {“records”: [{“fields”: {“Name”: “a”, “Priority”: 3}}]}
print(requests.post(url,data=json.dumps(data_list),headers=h).text)

13 replies

ScottWorld
Forum|alt.badge.img+35
  • Genius
  • 9808 replies
  • June 29, 2020

You’re not using the right syntax for any of those lines.

Go to https://www.airtable.com/api and it will give you the appropriate syntax to use for each one of your bases and for each function you want to perform.


  • Author
  • New Participant
  • 3 replies
  • June 29, 2020

You’re not using the right syntax for any of those lines.

Go to https://www.airtable.com/api and it will give you the appropriate syntax to use for each one of your bases and for each function you want to perform.


I developed it based on the API

Can you tell me what’s wrong


Forum|alt.badge.img+19
  • Inspiring
  • 3263 replies
  • June 29, 2020

You’re not using the right syntax for any of those lines.

Go to https://www.airtable.com/api and it will give you the appropriate syntax to use for each one of your bases and for each function you want to perform.


On first glance, it looks a bit odd until you realize this is Python.

Hi @wenju_fan, and welcome to the community!

I believe this is Python because the json.dumps() method caught my eye and this only exists in Python. Can you confirm this is Python?

I believe the issue is in the header - change it to this:

'Authorization' : 'Bearer ' + cAirtableAPIKey,


ScottWorld
Forum|alt.badge.img+35
  • Genius
  • 9808 replies
  • June 29, 2020

On first glance, it looks a bit odd until you realize this is Python.

Hi @wenju_fan, and welcome to the community!

I believe this is Python because the json.dumps() method caught my eye and this only exists in Python. Can you confirm this is Python?

I believe the issue is in the header - change it to this:

'Authorization' : 'Bearer ' + cAirtableAPIKey,


Thank you, @Bill.French!


  • Author
  • New Participant
  • 3 replies
  • June 29, 2020

Thank you, @Bill.French!


Yeah,this is python
as you said,I tried this:


  • Author
  • New Participant
  • 3 replies
  • June 29, 2020

Thank you, @Bill.French!


If you have a demo,i will appreciate it if you can send me a copy

thanks


Forum|alt.badge.img+19
  • Inspiring
  • 3263 replies
  • June 29, 2020

Yeah,this is python
as you said,I tried this:


Okay - let’s be sure about your code - can you publish the latest version?


  • New Participant
  • 1 reply
  • October 23, 2020

the syntax looks fine. Probably you got the key or the url wrong.


  • Participating Frequently
  • 5 replies
  • January 20, 2022

I’m running into the same issue when making any API call in the iOS Shortcuts app on my iPhone, but it works fine with curl and Postman, and even Shortcuts on my Macbook.
endpoint: https://api.airtable.com/v0/appw8uXq7gglhzgE5/Dictionary
header: “Authorization”:“keyxxxxxxxxxxxxx8Ng”,

I’ve double and triple checked and copypasted the url and key between the apps where it works and the ones where it doesn’t, but nothing changes


kuovonne
Forum|alt.badge.img+29
  • Brainy
  • 6009 replies
  • January 21, 2022

I’m running into the same issue when making any API call in the iOS Shortcuts app on my iPhone, but it works fine with curl and Postman, and even Shortcuts on my Macbook.
endpoint: https://api.airtable.com/v0/appw8uXq7gglhzgE5/Dictionary
header: “Authorization”:“keyxxxxxxxxxxxxx8Ng”,

I’ve double and triple checked and copypasted the url and key between the apps where it works and the ones where it doesn’t, but nothing changes


It looks like you are missing the word Bearer


  • Participating Frequently
  • 5 replies
  • January 21, 2022

It looks like you are missing the word Bearer


Good catch, though in this case I had just forgotten that when typing out the question, I actually do have the Bearer included in Shortcuts and the other places mentioned.

I have narrowed it down to an issue not related to Airtable (so feel free to skip reading if you’re not familiar with Shortcuts):
I have several shortcuts (think of them as scripts) that run another shortcut inside to pull in a dictionary object containing some variables like the API key, and then the main shortcut plops that into the Authorization header for the API call. But there appears to be a bug in the iOS version of Shortcuts right now that is making it impossible to pass variables from an inner shortcut to the outer shortcut that just ran it.

For example I can show this pair of test shortcuts doesn’t pass the dictionary value correctly:


I’ll be making a support request to Apple to fix their bug,


Forum|alt.badge.img
  • New Participant
  • 1 reply
  • August 2, 2022

i am trying to retrieve a base from my airtable in Node.js
using
const fetchCourses = () => fetch(“https://api.airtable.com/v0/app...../Products”);

and this is the error i am getting

{“error”:{“type”:“AUTHENTICATION_REQUIRED”,“message”:“Authentication required”}}


Forum|alt.badge.img+1
  • New Participant
  • 1 reply
  • March 5, 2023

i am trying to retrieve a base from my airtable in Node.js
using
const fetchCourses = () => fetch(“https://api.airtable.com/v0/app...../Products”);

and this is the error i am getting

{“error”:{“type”:“AUTHENTICATION_REQUIRED”,“message”:“Authentication required”}}


Were you able to figure it out - currently trying to set up a Shortcut on iOS. Getting the same error.