As I am using vendure graphql in my next js project and I am using apolloClient for query and mutation , I am facing an problem while loging in
My client code
import { HttpLink } from "@apollo/client";
import {
NextSSRInMemoryCache,
NextSSRApolloClient,
} from "@apollo/experimental-nextjs-app-support/ssr";
import { registerApolloClient } from "@apollo/experimental-nextjs-app-support/rsc";
const { BACKEND_URL } = process.env;
export const { getClient } = registerApolloClient(() => {
return new NextSSRApolloClient({
cache: new NextSSRInMemoryCache(),
link: new HttpLink({
uri: BACKEND_URL as string,
credentials: "include",
}),
});
});
My login code
const apolloClient = getClient();
export const login = async ({
username,
password,
rememberMe,
}: MutationLoginArgs) => {
const response = await apolloClient.mutate<LoginMutation>({
mutation: Login,
variables: {
rememberMe: rememberMe ? true : false,
username,
password,
},
});
return response;
};
I am getting vendure-auth-token in graphql playground network >> response >> headers.
How to get this vendure-auth-token in code for further authorize query and mutation