Open MattyBalaam opened 2 weeks ago
Hey there, although authkitLoader
isn't technically supposed to be used in Remix actions, there is a workaround to get it doing what you want.
I'm going to leave this issue open as a reminder to add a Remix specific method for getting the user data, but in the meanwhile the following should work:
export async function action({ request }: ActionFunctionArgs) {
const resp = await authkitLoader({
request,
params: {},
context: {},
});
const { accessToken } = await resp.json();
console.log('action:', accessToken);
// make follow up API calls with the access token
}
The above works because our loader doesn't require either params
or context
to function, just the request.
I am maybe just misdirected by the naming here - Can you call
authkitLoader
inside a remix action as well? We need to get tokens to call endpoints in our actions and I’m not 100% sure that you can use it in an action.