English 中文(简体)
附录二
原标题:BE REDIRECTED TO KEYCLOAK LOGING PAGE FROM REACT APP

I configured keycloak with ExpressJS 以及 would like to check if everything is working correctly. For this, I created these two scripts. One is an axios script to send the request to the server, 以及 the other is a server side script. script to h以及le the request. But it doesn t redirect me to the keycloak login page as I expected. I got an error instead Here are some screenshots: THANKS YOU

申请使用的文字如下:

const PORT = 3001
const HOST = `http://localhost:${PORT}`;

/**
 * This function aim is to log the user in
 * @param user the user username
 * @param pwd the user password
 **/
export function loginRequest(user, pwd,) {
    axios.post(`${HOST}/ `, {
        email: `${user}`,
        pwd: `${pwd}`
    })
        .then(function (res) {
            return res.data
        })
        .catch(function(err) {
            console.log( ERROR while sending login request : , err);
        })

    return false;
}

There is my front-ent where am getting the error. i just use the button to send request on click

以及

https://i.stack.imgur.com/atxB2.png”rel=“nofollow noreferer”> 我的关键组合是

i 试图在互联网上发现的许多东西,如在网络来源领域添加+,但并不奏效。

问题回答

背弃CORS错误的“轴心”是你的 b。

CORS是一个浏览器方的安全建筑。 当您的浏览器发出“fetch”或“axios”电话时,它首先向URL发出一项OPTIONS请求,要求它最终提出GET/POST/PUT/...申请。

浏览器检查了来自禁止化学武器组织要求的答复负责人。 这就是服务器如何告诉浏览器,“从下列网站取出一个声音是安全的:............”换言之,“从以下网站下载的网页上调这一服务器的图像是安全的:......”。 这一机制是,服务器能够告诉浏览器,哪些网站/网页可以安全地从预报器中打电话。

例如,一家银行的服务器将显示,从银行网站(https://mybank.com)上传来的APICES。 任何人在其他一些地址(例如)上张贴网页 可能向银行的APIC服务器打电话,但浏览器会留下CORS错误,因为假的网页不会从一个“有效”的网站上提供。

因此,就你而言,请ReSPONSE在您的《发展工具》表格中向OPTIONS发出呼吁,看看它是否正在作出适当反应(即:>-Access-Control-Allow-Origin: *Access-Control-Allow-Origin:http:// localhost:)。 否则,你的浏览器将不允许你打电话到

在您的组合中,似乎还有一些令人厌恶的代理,因为有人呼吁?





相关问题
How to use one react app into another react app?

I have two react apps, parent app and child app. and child app have an hash router. I have build the child app using npm run build, It creates build folder. That build folder moved into inside the ...

how to get selected value in Ant Design

I want to print the selected value, and below is my option list: const vesselName = [ { value: 0 , label: ALBIDDA , }, { value: 1 , label: ALRUMEILA , }, { value: 2 ,...

How to add a <br> tag in reactjs between two strings?

I am using react. I want to add a line break <br> between strings No results and Please try another search term. . I have tried No results.<br>Please try another search term. but ...

热门标签