Reputation: 327
let res = await axios({
method: 'get',
url: url1,
params: params,
/* headers: { 'Authorization': "Bearer `${token}`" } */
});
On passing the headers, I'm getting CORS error (token is string)
This is the code of backend (flask)
app = Flask(__name__)
app.config.update(
TESTING=True,
SECRET_KEY="super secret key",
JWT_ACCESS_TOKEN_EXPIRES=datetime.timedelta(minutes=30),
CORS_HEADERS='application/json'
)
app.config['CORS_HEADERS'] = 'Content-Type'
api = Api(app)
login_manager = LoginManager()
login_manager.init_app(app)
jwt = JWTManager(app)
CORS(app, support_credentials=True)
Base.metadata.create_all(engine)
Upvotes: 1
Views: 614
Reputation: 6336
You are trying to pass some object (JSON?) in a GET request. You should use a POST request instead:
let res = await axios({
method: 'post',
url: url1,
params: params,
headers: { 'Authorization': "Bearer `${token}`" }
});
Upvotes: 1