The cookie should be sent as part of the request like any other cookie assuming CORS is respected and it should be since dbAuth’s handler is just a function like this would be.
Be sure to pass the auth-provider in the header as per the documentation.
Hi. Thanks. I’ve figured out how to get the token using getToken and I am sending this in the request. However, since I am using dbAuth, I think I need to send the dbAuth cookie. Unfortunately I don’t know how to access the dbAuth cookie.
The Prisma db is an sdk/client that interacts with external info — a database.
Using any other client/sdk that fetches or interacts with data like any other api is absolutely appropriate to be a service and part of your GraphQL api. In fact it’s encouraged.
Just custom write the sdl as a query and the type of the info it returns.
Thank you David and Tobbe. I took you excellent advice and moved away from a function for my api call to using a graphql service. I actually took the opportunity of creating a database table to log apicalls per user so having a graphql service is a better choice. I now call my api from within my graphql service. Thanks a million for the direction.
Your addition of keeping a log/audit for the responses is a great one.
You can use to to do retries on failures or even cache the results and a timestamp and only refetch from the outside services wheb the data is stale to limit requests.