Geoff Ferrari
KKinde
•Created by Geoff Ferrari on 7/26/2024 in #💻┃support
How to use React SDK with axios
In case it's helpful to anyone else, I adjusted the first function definition as follows to prevent some inscrutable axios errors:
// src/hooks/useFetchToken.ts
import { useKindeAuth } from '@kinde-oss/kinde-auth-react';
export const useFetchToken = () => {
const { getToken } = useKindeAuth();
const fetchToken = async () => {
try {
const token = await getToken();
return token;
} catch (error) {
return null;
}
};
return { fetchToken };
};
5 replies
KKinde
•Created by Geoff Ferrari on 7/26/2024 in #💻┃support
How to use React SDK with axios
Thanks @Andre @ Kinde - this approach seems to do the trick! Much appreciated.
5 replies