1

我正在尝试在我的网站上实现聊天引擎,但是在尝试访问聊天引擎 api 时,我得到 --CORS No Allow Credentials--“如果 CORS 标头 'Access-Control-Allow-Origin' 是 '*,则不支持凭据'"

聊天.js

import { ChatEngine } from 'react-chat-engine';
import React from 'react';

import LoginForm from './components/LoginForm.jsx'
import './chat.css';

const projectID = 'projectID ';

const chat = () => {
  if (!localStorage.getItem('username')) return <LoginForm />;

  return (
    <ChatEngine
      height="100vh"
      projectID={projectID}
      userName={localStorage.getItem('username')}
      userSecret={localStorage.getItem('password')}
    />
  );
};

export default chat;

起初我什至无法登录并且遇到了同样的错误,但我通过添加withCredentials: false到 axios.post 来修复它

4

0 回答 0