convex-js
convex-js copied to clipboard
Convex client setAuth wierd behaviour
Question before start: Should convex client call fetchAccessToken with forceRefreshToken: true when this is a newly created token that has just been set?
If not there is a wierd behaviour with react client which:
- First calls
fetchAccesswith force: false. - Then executes second one with
force: true.
IMPORTANT: I provide the same token for both of the fetchAccessToken calls.
So according to the blow spec there is something wrong. Because server didn't reject the previous authentication, but client calls the fetchAccessToken with force refresh.
/**
* An async function returning the JWT-encoded OpenID Connect Identity Token
* if available.
*
* `forceRefreshToken` is `true` if the server rejected a previously
* returned token, and the client should try to fetch a new one.
*
* See {@link ConvexReactClient.setAuth}.
*
* @public
*/
export type AuthTokenFetcher = (args: {
forceRefreshToken: boolean;
}) => Promise<string | null | undefined>;