我正在尝试在我的反应应用程序中实现共享点文件浏览器。使用microsoft/file-browser
这个ans代码如下。但是得到xxx... from origin 'http://localhost:3000' has been blocked by CORS policy
任何想法如何为此启用CORS
import * as React from "react";
import { GraphFileBrowser } from '@microsoft/file-browser';
class App extends React.Component {
getAuthenticationToken() {
return new Promise<string>(resolve => {
resolve(
"VALID TOKEN"
);
});
}
render() {
return (
<GraphFileBrowser
getAuthenticationToken={this.getAuthenticationToken}
onSuccess={(selectedKeys: any[]) => console.log(selectedKeys)}
onCancel={(err: Error) => console.log(err.message)}
endpoint='https://XXX.sharepoint.com'
/>
);
}
}
export default App;