Bearer Token Post Request Errors

Hello,

I’m attempting to make a POST request using a bearer token and keep getting error unexpected token "{"

I am confidence I am storing the token in state after the first POST authentication request, but I have not been successful using the access_token returned by the initial authentication request in additional requests.

Not an engineer by trade. Would appreciate some help solving this!

Thanks,
David

I think the issue is that I’m attempting to hit a graphql endpoint.

@dallen hello!
Could you send me the link to your project so that we could help? In DM.

1 Like

Hi @dallen,

I looked at your setup and it seems that you are trying to send the HTTP Body as a JS Object
image

but the Graphql query doesn’t seem to be a valid JS Object, that’s why you are getting this error. Try setting this param to Raw (that would mean you are sending it “as is”).

Another thing I noticed while testing your setup is that the API has CORs configuration forbidding requests from UI Bakery domains, so you might want to utilize the Proxy Request option to avoid this issue:
image

Hope this helps!

2 Likes

Thank you! Yes, this did help.

I changed to proxy request, and updated the body of the request. After some experimentation (and help from Insomnia) I was able to successfully request the data.

2 Likes