• Resolved bohdanwlcm

    (@bohdanwlcm)


    I need to use PaidMembershipsPro API to programmatically change a membership of a user.

    For my Admin user I created Application Password, then I created base64 from auth data:
    const token = Buffer.from(${process.env.WP_USERNAME}:${process.env.WP_APP_PASSWORD}).toString( 'base64');

    Set Basic Authorization:
    axios.defaults.headers.common['Authorization'] = Basic ${token};

    But any /pmpro/v1 route, I’m trying to trigger always returns me the error:

    data: {
       status: 'error',
       error: 'Restricted',
       error_description: 'Sorry, you are not allowed to access REST API.'
    }

    My user has all pmpro capabilities.

    • This topic was modified 2 years, 3 months ago by bohdanwlcm.
Viewing 5 replies - 1 through 5 (of 5 total)
  • Plugin Support Kim White

    (@kimwhite)

    Hello @bohdanwlcm,

    I’m sorry you are having problems with this. The 403 error is a permission error indicating that the incorrect password or username has been entered and that this could be related to something in your code.

    You will need to revise your code and confirm your login details are correct.

    Kim W

    Thread Starter bohdanwlcm

    (@bohdanwlcm)

    Which username and password should I use?

    Currently I use admin’s username and password and I’m sure that this is the correct data

    Plugin Author Andrew Lima

    (@andrewza)

    This sounds like you are correctly using the API and something is incorrect with your capabilities of some sort or blocking your REST API access – I cannot say for certain without looking into this further and difficult to assume the cause.

    Are you able to access default WordPress REST API routes?

    Thread Starter bohdanwlcm

    (@bohdanwlcm)

    Yes, I’m able to access any other WordPress REST API route, except this one

    Plugin Author Andrew Lima

    (@andrewza)

    I’ve run some further tests and you should receive a 401 error if your permissions are wrong. 403 indicates a different issue that may be more server related.

    I am unable to replicate this issue on my development site. If you have a local environment please can you run tests with Postman and basic authentication to see if the issue persists for you?

    Here is a screenshot for reference on my own test using PostMan, basic authentication and a PMPro REST route. (You may open this in a new tab to zoom in).

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘REST API 403 error’ is closed to new replies.