API error: 403 rest_forbidden
-
Hello!
I get an error when trying to send a GET request to endpoint http://mysite/wp-json/filebird/public/v1/folders.
I’m making a react app. I use wpapi for sending requests and JWT plugin for generating Bearer tokens.
My code:
export async function getMedia() { try { const jwt = await wp.url(reactPress.api.rest_url + 'jwt-auth/v1/token') .create({ username: 'admin', password: appPassword, }) .then((result) => { return result; }); const result = await wp.url(reactPress.api.rest_url + 'filebird/public/v1/folders') .setHeaders('Authorization', 'Bearer ' + jwt.token); return result; } catch (error) { console.error(error); return []; } }How can I fix my problem?
Viewing 5 replies - 1 through 5 (of 5 total)
Viewing 5 replies - 1 through 5 (of 5 total)
The topic ‘API error: 403 rest_forbidden’ is closed to new replies.