-1

我正在 vueNative App 中使用 wordpress 实现 jwt。当我调用 api 时,我得到临时标题显示警告。我也收到 403 错误。下面是我编写的代码。

 axios.post('https://ishopee.in/wp-json/jwt-auth/v1/token',null,{
                    headers: {
                    'username': 'nayanjariwala123456789@gmail.com',
                    'password': 'Baby_0123'
                    }
                })
                .then(res => {
                    console.log("---->SuccessFully Login".res);
                })
                .catch(err => {
                    console.log('--->'+err); 
                })

这是我从我的 vue 本机应用程序提出的请求

header
Request URL: https://ishopee.in/wp-json/jwt-auth/v1/token
Request Method: POST
Status Code: 403 Forbidden
Referrer Policy: no-referrer-when-downgrade

Response Headers
Access-Control-Allow-Headers: Authorization, Content-Type
Access-Control-Expose-Headers: X-WP-Total, X-WP-TotalPages
Allow: POST
Alt-Svc: quic=":443"; ma=2592000; v="39,43,46", h3-22=":443"; ma=2592000
Cache-Control: no-store, no-cache, must-revalidate
Connection: Keep-Alive
Content-Type: application/json; charset=UTF-8
Date: Wed, 16 Oct 2019 08:33:00 GMT
Expires: Thu, 19 Nov 1981 08:52:00 GMT
Link: <https://ishopee.in/wp-json/>; rel="https://api.w.org/"
null: HTTP/1.1 403 Forbidden
Pragma: no-cache
Server: LiteSpeed
Set-Cookie: PHPSESSID=dd9ecfdbdae48539a6bd1d1847d68c1d; path=/
Transfer-Encoding: chunked
X-Android-Received-Millis: 1571214780555
X-Android-Response-Source: NETWORK 403
X-Android-Selected-Protocol: http/1.1
X-Android-Sent-Millis: 1571214777449
X-Content-Type-Options: nosniff
X-Powered-By: PHP/7.1.28
X-Robots-Tag: noindex

Request Header
Provisional headers are shown
Accept: application/json, text/plain, */*
Content-Type: application/x-www-form-urlencoded
password: Baby_0123
username: nayanjariwala123456789@gmail.com

4

1 回答 1

0

JSON body 似乎工作我提出了以下请求,现在它可以工作了

axios.post('https://ishopee.in/wp-json/jwt-auth/v1/token',
                    {
                        'username': 'nayanjariwala123456789@gmail.com',
                        'password': 'Baby_123'
                    }
                })
                .then(res => {
                    console.log("--->SuccessFully Login".res);
                })
                .catch(err => {
                    console.log('--->'+err); 
                })
于 2019-10-16T10:02:55.203 回答