我在react-redux&API app上有一个客户端应用程序loopback.
对于我的本地测试,我在端口8080上运行客户端应用程序,在端口3000上运行服务器应用程序
当我尝试使用loopback-passport component客户端应用测试Google OAuth(使用)时,我收到以下错误.
当我使用POSTMAN测试它时,没有问题.
这是客户端代码,
require('babel-polyfill');
import { CALL_API } from 'redux-api-middleware';
import C from '../constants';
const API_ROOT = 'http://localhost:3000';
function googleLogin() { return async(dispatch) => {
const actionResp = await dispatch({
[CALL_API]: {
endpoint: API_ROOT + '/auth/google',
headers: {
'Access-Control-Allow-Credentials': 'false',
'Access-Control-Allow-Methods': 'GET',
'Access-Control-Allow-Origin': API_ROOT
},
method: 'GET',
types: ['GET', 'GET_SUCCESS', 'GET_FAILED']
}
});
if (actionResp.error) {
console.log(actionResp);
throw new Error('Some error in communication', actionResp);
} else {
console.log(actionResp);
} …Run Code Online (Sandbox Code Playgroud) atom-editor ×1
cors ×1
ecmascript-6 ×1
eslint ×1
javascript ×1
loopbackjs ×1
reactjs ×1
redux ×1