How to fix login? #6672
Replies: 1 comment
-
We had a temporary outage on our services. Now it should be resolved. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Im having problems with my auth.ts. I cannot login with the mock user michael.scott
`import type { AuthProvider } from "@refinedev/core";
import type { User } from "@/graphql/schema.types";
import { API_URL, dataProvider } from "./data";
/**
*/
export const authCredentials = {
email: "[email protected]",
password: "demodemo",
};
export const authProvider: AuthProvider = {
login: async ({ email }) => {
try {
const { data } = await dataProvider.custom({
url: API_URL,
method: "post",
headers: {},
meta: {
variables: { email },
rawQuery:
mutation Login($email: String!) { login(loginInput: { email: $email }) { accessToken, } }
,},
});
},
logout: async () => {
localStorage.removeItem("access_token");
},
onError: async (error) => {
if (error.statusCode === "UNAUTHENTICATED") {
return {
logout: true,
};
}
},
check: async () => {
try {
await dataProvider.custom({
url: API_URL,
method: "post",
headers: {},
meta: {
rawQuery:
query Me { me { name } }
,},
});
},
getIdentity: async () => {
const accessToken = localStorage.getItem("access_token");
},
};`
Beta Was this translation helpful? Give feedback.
All reactions