Yes. Using jQuery and including the beforeSend with the basic auth. Again it works if the user is either not logged in or is an administrator. But if logged in and a different role (editor, author, contributor etc) it says it's not authorized.
Any ideas? We are blocked from going live with this site due to this bug.
To be clear the message we are getting is "Sorry, you are not allowed to do that."
Oh just a bit more context. This only seems to affect either GET endpoints or possibly just the /views endpoints. I am able to run the PATCH and DELETE endpoints without error.
This code works fine:
jQuery.ajax({ type: 'PATCH', url: '/wp-json/frm/v2/entries/'+posting_id, dataType: 'json', beforeSend: function ( xhr ) { xhr.setRequestHeader( 'Authorization', 'Basic MyEncodedApiKey=='); }, success: function(response) { // do my thing here. } });
This code causes an error (same user, same session, same role, same page):
jQuery.ajax({ url: '/wp-json/frm/v2/views/4290', type: 'GET', dataType: 'json', data: {'restaurant' : restaurant}, beforeSend: function ( xhr ) { xhr.setRequestHeader( 'Authorization', 'Basic MyEncodedApiKey=='); }, success: function(response) { jQuery('#objecttoinjecthtmlinto').append(response.renderedHtml); } });
The error I'm getting is:
code "rest_forbidden"
message "Sorry, you are not allowed to do that."
data Object { status: 403 }
status 403
I would really appreciate some help on this.
Sorry Andrew. I don't have the bandwidth to do a deep dive into your system as a community volunteer. If you want to engage me in a paid project, you can make a request here: https://formidable-masterminds.com/project-application/
Please login or Register to submit your answer