'Problem with user authorization in spring boot and react js

So I am making an App in spring boot (backend) and react js (frontend). On my backend, when I type url (http: // localhost: 8080 / login) in my browser, I can login example. After logging in with the correct [there is request] 2 values, I can enter another URL such as (http: // localhost: 8080 / anxieties /anxieties). So if I log in with my browser it works fine. Problem is when i try connect backend with front and I try to log in react.

I have a logIn form in react and i did endpoint to my backend in Spring boot:

 async function login(){
    
    console.warn(email + "  " + password);
    const data_form = new FormData();
    data_form.append("email", email);
    data_form.append("password", password);
    fetch("http://localhost:8080/login",{
        method: 'POST',
        // headers:{
        //     "Content-type": "application/json",
        //     "Accept": "application/json"    
        // },
        body: data_form
    }).then((response) => response)
    .then((response) => console.log(response));  
}

Problem is when i try to log in with correct values there is message like this: good values, when i log with wrong values there is communicate wrong value. Login doesn't work properly because I can't access other urls in react with endpoints (http: // localhost: 8080 / anxieties /anxieties).

This is my first project like this and i have no idea why log work in browser but in react no. I think end point is correct, becous when i type fine values, its gives me similar communicate like in browser (i mean 404), but unlike the browser, authorization doesn't work I i can't get access to another url-s



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source