Mikle
Mikle
Explore posts from servers
SSolidJS
Created by Mikle on 9/1/2023 in #support
Fetching data with authorisation token
I’m using auth.js with cognito and my backend requires the authorisation token to be present with every request. I’ve managed to get this working by using createServerData$ and then passing it to a generic GET function that will retrieve the token from the request. Is this the best way of doing this? I’m struggling to create a wrapper around createServerData. I have a dashboard of components that each hit different endpoints, my thoughts were to have them handle their fetching themselves but it’s a lot of duplicate code with createServerData each time. Has anyone else had a similar problem?
8 replies