tersercoder
tersercoder15mo ago

Issue with Bearer token

When I create a Bearer token under my account (without expiry) , I can use it to retrieve workspaces and such, but when I try to create a script , it always gives me a 401. It works with a Session cookie, but I would like it to work with Bearer tokens. Obviously the bearer token does work (because I can retrieve authenticated objects like workspaces), but no matter what I do, /scripts/create always pops a 401. What am I doing wrong or is that simply not supported?
4 Replies
rubenf
rubenf15mo ago
it might be that you do not have the permissions to create the script at the path you are trying to it's not the bearer token not getting accounted for, that's for sure
tersercoder
tersercoder15mo ago
i am trying the exact copy of what i see in the browser network tab, so : - i make a token with Account Settings for my (admin) user - in the web interface, i make a script under the path /u/itsme/test - that works, and i see the call do /scripts/create succeeding - then i remove that script via the web interface - i copy the exact json it used to create that script from chrome - i copy that into my curl with the bearer token from step #1 and get a 401
rubenf
rubenf15mo ago
chrome has a way to copy a request as a curl command you should do that, and just replace the token you will see it works so the error is somewhere else the whole api has only one way to deal with cookie and bearer tokens, there is no distinction by endpoint that's why I know it's not your issue
tersercoder
tersercoder15mo ago
let me try! i'm sure it's something else, just trying to figure what; i thought maybe it's known, but if not, i'm going to debug further; thanks! When i figure something, i'll report back ok, when i replace the cookie with the bearer token it does work indeed. so now i'm going to compare what's the difference thanks, it worked; seems we did something not very smart. but sometimes you go down the path of debugging and then it was never supported in the first place. Thanks and keep up the good work!