S
S
sinneren2019-04-19 09:15:02
API
sinneren, 2019-04-19 09:15:02

How to get rid of CORS error on localhost when authorizing vk.api?

I use CRA. I want to log in to VK for further API work. I send a request via axios to ' https://oauth.vk.com... ', in response I get a CORS error. I understand that I should set 'Access-Control-Allow-Origin':'*' on the server, but I don't want to eject. I registered the VK domain, the Oauth domain in the proxy, but the error does not disappear. I don't understand much about servers.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Anton Spirin, 2019-04-19
@sinneren

I understand that I should set 'Access-Control-Allow-Origin':'*' on the server, but I don't want to eject.

No, this header must be specified on the vk authorization server. But he's not there on purpose.
After all, the documentation says in Russian:
To get an access_token , you need to make a request from your server to https: //oauth.vk.com/access_token, passing the following parameters:

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question