Graph API 401 error


I am working on a web application that authenticates with Keycloak. I added Microsoft as an Identity Provider and I can log in with my Microsoft account.

I would like to make use of the Microsoft Graph REST API, but my keycloak token is always rejected and I get a 401 unauthorized error.

Here is my request:

const url = "$metadata#users({myUsername})/drive/root/children"
const token = myKeycloakToken
const docs = await axios.get(url, { headers: { 'Authorization': "Bearer " + token } })

If I change myKeycloakToken to a token generated in Graph Explorer the request works fine.
So I guess something must be wrong with the Keycloak token.

Any clue on what is going wrong here?