Skip to content

fetch doesn't work for requests in place of axios  #1

Description

@rakataprime

Hello,

I recently was trying to use this as template with the protected api endpoints but I wasn't able to change out axios for fetch
in src/services/message.service.js

const res = await fetch(${apiServerUrl}/api/messages/protected, { headers: { "content-type": "application/json", "Authentication": Bearer ${accessToken}}, method: 'GET', }) console.log("got data fetch") const data2 = await res.json() console.log(data2)

The fetch versions 401s with the https://github.com/auth0-developer-hub/api_fastapi_python_hello-world/tree/basic-role-based-access-control/application repo on the fetch call but not on the axios version. I thought I would document this so other people know they wont be able to use fetch with this template.

Is there a reason why axios has to be used or something going on with token caching with fetch?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions