WordPress REST API의 403 "rest_forbidden" 오류(설정 전용)
WordPress에서 설정(/wp/v2/settings)을 제외한 모든 API를 받았습니다.rest_returning 오류입니다.
{
"code": "rest_forbidden",
"message": "Sorry, you are not allowed to do that.",
"data": {
"status": 403
}
}
사용자에게 해당 경로의 데이터에 액세스할 수 있는 올바른 권한이 없습니다.개봉 즉시/settings/루트에는manage_options허가( 참조)get_item_permissions_check메서드).
// found in WP Core class-wp-rest-settings-controller.php
/**
* Checks if a given request has access to read and manage settings.
*
* @since 4.7.0
*
* @param WP_REST_Request $request Full details about the request.
* @return bool True if the request has read access for the item, otherwise false.
*/
public function get_item_permissions_check( $request ) {
return current_user_can( 'manage_options' );
}
API 자격 증명과 관련된 사용자는 무엇입니까?
설정 엔드 포인트는 사용자가 가지고 있어야 합니다.manage_options사용 권한: 커스텀 역할을 사용하는 경우 를 사용하여 추가할 수 있습니다."manage_options" => true;
그렇지 않으면 사용자 관리자 역할만 수행합니다.
문제가 있는 경우는, https://wordpress.org/plugins/application-passwords/ 의 플러그 인을 참조하십시오.
프로파일에서 어플리케이션 비밀번호를 생성하여 기본 인증과 함께 사용하면 사용자 이름은 WordPress 사용자 이름 또는 이메일과 동일하며 비밀번호는 새로 생성된 비밀번호가 됩니다.
HTTP 헤더 개서 규칙을 .htaccess 파일에 추가해야 할 수도 있습니다.이것에 대해서는, https://github.com/WordPress/application-passwords/wiki/Basic-Authorization-Header----Missing 를 참조해 주세요.
언급URL : https://stackoverflow.com/questions/45931189/403-rest-forbidden-error-in-wordpress-rest-api-but-only-for-settings
'programing' 카테고리의 다른 글
| 파일에서 AngularJs 변수로 HTML 템플릿 로드 (0) | 2023.03.20 |
|---|---|
| mongodb 저널 파일은 삭제해도 안전한가요? (0) | 2023.03.20 |
| 각도 5 - 클립보드에 복사 (0) | 2023.03.20 |
| 모든 포스트 데이터와 포스트 메타를 저장한 후 발생하는 WordPress 훅은 무엇입니까? (0) | 2023.03.20 |
| 스프링 데이터 JPA는 네이티브 쿼리 결과를 비엔티티 POJO에 매핑합니다. (0) | 2023.03.20 |