question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Unauthorized when making POST request with ajax

See original GitHub issue

Hey, didnt find anything on this so Im asking.

The documentation says that in order to save data (or to get filtered data) you should use this: fetch('/api/collections/save/posts?token=xxtokenxx', {... However I am getting {error: 'Unauthorized'} even though the supplied token is valid. I tried with the general token you find in the settings and admin api account token as well.

Im using the master branch.

Any insight on this is welcome. Thanks

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:5

github_iconTop GitHub Comments

2reactions
VojtechKloscommented, Oct 29, 2017

Also just for the record there is a typo in the docs it says when retrieving filtered data the url is /api/collections/save/posts?token=xxtokenxx when in fact there should be GET instead of SAVE so: /api/collections/get/posts?token=xxtokenxx is correct.

1reaction
VojtechKloscommented, Oct 29, 2017

OK it works now when I created new user and used its token. I feel like this is a “bug”? I will keep the issue open in case it is in fact a bug.

Cheers.

Read more comments on GitHub >

github_iconTop Results From Across the Web

401 Unauthorized on .ajax post - jquery - Stack Overflow
If this page is hosted in a Sitecore solution, which it seems like it is, the page request is probably going through the...
Read more >
401 Unauthorized POST request with jQuery - Laracasts
I'm using jQuery script in one of my views to send POST request to my API route in Laravel 6: The request looks...
Read more >
jQuery Ajax Unauthorized error on POST
I first get the form digest: var formDigest; $. ajax({ async: false, url: "https://#################/_api/contextinfo", type: "POST", headers: ...
Read more >
Ajax API call - 401 Unauthorized Error - Customize with code
I'm creating a GET request from my square space site to Big commerce using ajax API call. But facing 401 unauthorized error.
Read more >
web service error 401 at HTTP Basic Authentication with ...
web service error 401 at HTTP Basic Authentication with jQuery AJAX requests · 1.CREATE web SERVICE at sa 17 with Support WEB CORS....
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found