0
votes

With Vue 3, i'm trying to authenticate to firebase using REST API.

I'm using vs code and run the code in a local serve with npm run serve.

axios
.post('https://identitytoolkit.googleapis.com/v1/accounts:signIn?key=[MY_API_KEY]', {
       email: credentials.email,
       password: credentials.password,
       returnSecureToken: true
})

I'm getting a CORS problem. In the console i've the following error:

Cross-Origin Request Blocked: The Same Origin Policy disallows reading the remote resource at https://identitytoolkit.googleapis.com/v1/accounts:signIn?key=[MY_API_KEY]. (Reason: CORS header ‘Access-Control-Allow-Origin’ missing).

How can i resolve the problem?

1

1 Answers

0
votes

You should install an npm install firebase --save to authenticate with firebase