获取TOKEN oauth2 - POST客户端数据 - 错误请求

问题描述 投票:0回答:1

我在反应APP中使用令牌API时遇到问题(404:错误请求)。在Post man中,它运作得很好

  const requestOptions = {
            method: 'POST',
            mode: "no-cors", // no-cors, cors, *same-origin
            cache: "no-cache", // *default, no-cache, reload, force-cache, only-if-cached
            credentials: "include", // include, *same-origin, omit
            redirect: "follow", // manual, *follow, error
            referrer: "no-referrer", // no-referrer, *client
            headers: {
            },
            body: JSON.stringify({
                "client_id": "1_15dpzlnknhtwk8sgo4gwo800okogc4g00gk4k04g4g0cgc0ww0",
                "client_secret": "dc86f30rr6okw8w84c8owkcko08s4k8k4c4c4k04osow8skko",
                "grant_type": "password",
                "username": "demoUsername",
                "password": "demoPassword"
            })
        };

fetch('http://localhost:8000/oauth/v2/token', requestOptions)
    .then(function(response) {
        console.log('response');
        console.log(response);

    })
    .then(function(myJson) {
        console.log(JSON.stringify(myJson));
    });

结果是:

enter image description here

enter image description here

这是我的security.yml

enter image description here

reactjs api symfony fosrestbundle
1个回答
0
投票

这是标题的问题。标题是空的现在它的工作

© www.soinside.com 2019 - 2024. All rights reserved.