Forum Academy Marketplace Showcase Pricing Features

[SOLVED] Invalid or expired token

Let’s see, I’ve got the success message after logging in through an API workflow. It gives me the user_id of the user who authenticated and a token and an expired time, which I assume is in total seconds.

I’ve tried immediately using that token to run an API workflow that’s got “this endpoint can be run without authentication” unchecked. It gives me a 401 error saying the api_token is invalid or expired.

Thing is, according to this conversation, it’s supposed to put the actual value of the api_token into the response. I’m getting the key “api_token” so I wondered if maybe there’s something wrong with how I’ve formatted the request?

REQUEST HEADERS
POST /version-test/api/1.0/wf/api_test HTTP/1.1
Host: howstr.bubbleapps.io
Accept: /
User-Agent: LiveCode (Win32)
Content-Type: application/json
Authorization: Bearer API_TOKEN
Content-Length: 524135
Expect: 100-continue
BODY
{
“file”: {
“private”: false,
“filename”: “overlapping_faces_2.PNG”,
“contents”: “pages and pages of base64 text”
},
“api_token”: “1482455629366x389154246076941500”
}

RESPONSE HEADERS
HTTP/1.1 401 Unauthorized
x-powered-by: Express
access-control-allow-origin: *
content-type: application/json
date: Fri, 23 Dec 2016 01:13:57 GMT
connection: close
transfer-encoding: chunked

RESPONSE BODY
{“statusCode”:401,“message”:“Invalid or expired token: api_token”}

Ugh, hokay, so…again, it turns out the problem was unclear/inaccurate documentation. Shoutout to @ramkhi for his troubleshooting pointing me in the right direction. Amazon Alexa skill integration for creating voice controlled Bubble apps

Putting the actual value of the token into the header, like so, fixed the “invalid or expired” error:

POST /version-test/api/1.0/wf/api_test HTTP/1.1
Host: howstr.bubbleapps.io
Accept: /
User-Agent: LiveCode (Win32)
Content-Type: application/json
Authorization: Bearer 1482460956475x628683180082589400
Content-Length: 3194667
Expect: 100-continue

1 Like