Hey,
I'm currently trying to create a small sample that uses OpenID Connect. My usecase is like that:
- I have a spring boot server with public and secure endpoints
- I have a react client
Based on your really great react (https://fusionauth.io/docs/quickstarts/quickstart-javascript-react-web) and spring (https://fusionauth.io/docs/quickstarts/quickstart-springboot-api) sample I easily got the 2 parts running individually. But now I want to have them in 1 app: Once a user is logged in (in the frontend) he can call a secured endpoint at the spring server.
My basic fetch call in react looks like that:
const getSecuredData = () => {
  const response = fetch(
    'http://localhost:8080' + '/api/secured',
    {
      method: 'GET',
      headers: {'Authorization':
            'Bearer ' + token}
    }
  ).then((response) => response.text())
  .then((data) => console.log(data))
  .catch(reason => alert("Not authenticated"));
}
The big problem is that I have no idea how to get the token. the react api provides a user but that does not have a token:
{
"applicationId": "e9fdb985-9173-4e01-9d73-ac2d60d1dc8e",
"birthdate": "1985-11-23",
    "email": "richard@example.com",
    "email_verified": true,
    "family_name": "Hendricks",
    "given_name": "Richard",
    "roles": [],
    "scope": "openid offline_access",
    "sid": "0021af21-227b-4374-b84a-55d4a28c22cd",
    "sub": "00000000-0000-0000-0000-111111111111",
    "tid": "d7d09513-a3f5-401c-9685-34ab6c552453"
}