Help with sappphire auth
i have problemms using the auth with sapphire
Solution:Jump to solution
if you do indeed have multiple outgoing requests they should also show up in the network tab
16 Replies
it continues giving me this error but the dashboard works, like all the data pass
we have quite a thorough guide on the website, have you carefully read each step? have you verified all your files to be similar to the guide? https://www.sapphirejs.dev/docs/Guide/plugins/API/getting-started
Other than that, validate the REST request you're sending from the frontend to the backend api route.
yes
like
it works look
that is on the dashboard
but i keep getting that error
so you get both an okay response and an error response? that should not be possible
yeah idk why
sounds like you're making 2 requests. Add some logging to check all outgoing and incoming requests
every time I log in the data pass ok and the api throws that error
i also thouht that so i did this
Either way you can also add logging on the backend by editing files in node_modules.
looks like you based the code off of https://github.com/skyra-project/skyra.pw/blob/main/src/pages/oauth/callback.tsx?
Instead of using that code I would rather recommend using https://tanstack.com/query/latest to make backend requests, that code is quite outdated in terms of best practises. Tanstack Query (previously React Query) has among many other features automatic request deduplication.
TanStack Query
Powerful asynchronous state management, server-state utilities and data fetching. Fetch, cache, update, and wrangle all forms of async data in your TS/JS, React, Vue, Solid, Svelte & Angular applications all without touching any "global state"
ill try to implement react query and see if it works
Solution
if you do indeed have multiple outgoing requests they should also show up in the network tab
oh yeah
i see now there are 2 req
yeah that'll be a problem for sure
short of react query I recommend investigating why that is
okay
ill do that
tysmm