I401 - External API - Twitter API

Options

Hi,

I'm make a Get request to Twitter API, using my bearer token as auth.

I'm using exactly the same config in Xano and Postman, Postman works fine, Xano always returns a 401…

My Twitter Bearer token is set as an Envorinment variable, that is then pushed into Headers array.

Any ideas? what am I missing? please help 🙏🏼

*******

{

request: {

url: https://api.twitter.com/2/users/by/username/TwitterDev,

method: GET,

headers: [

GET /2/users/by/username/TwitterDev HTTP/2,

Host: api.twitter.com,

accept-encoding: gzip, deflate,

content-type: application/json,

accept: application/json

],

params: []

},

response: {

headers: [

HTTP/2 401,

perf: 7626143928,

content-type: application/problem+json,

cache-control: no-cache, no-store, max-age=0,

content-length: 99,

x-transaction-id: f6cf6db836763e1f,

x-response-time: 1,

x-connection-hash: 1b230d0571be9d81f61b891f01d5cf8e45fc4a3575c3421f54695d23b2b54217,

date: Sat, 25 Feb 2023 09:22:19 GMT,

server: tsa_b

],

result: {

title: Unauthorized,

type: about:blank,

status: 401,

detail: Unauthorized

},

status: 401

}

}

Best Answer

  • Michael Udinski
    Michael Udinski Administrator

    ADMIN

    Answer ✓
    Options

    401 unauthorized means you're not authenticated properly with Twitter. Maybe the token is no longer valid when you are inserting it into Xano, I'd definitely consult Twitter's documentation for more clues as to what may be missing