Greetings,
it may seem foolish to ask, but I am totally lost on getting started with implementing Auth0.
I am trying to follow the auth0-spa-js documentation, but it’s not as clear as i might seem, at least not for me.
Can anyone shed some light over that will I need to write my custom login/signup forms in order to use the auth0-spa-js pacakge?
My main question is how the SPA SDK and the auth0-spa-js packages relate to one another. How do I, rather should I use both at the same time?
Furthermore, the documentation of auth0-spaj-js is sooo shallow, i barely understand what I have to do.
Well,off course I have set up my project using the SDK quickstart, but from there I was stuck, i couldn’t make a post-login action to retrieve an access token that i could use further in my GraphQL API authorization as well.
The SPA SDK is synonymous with the auth0-spa-js package.
Can you share more specifics on what part of the documentation you are struggling with or need help understanding?
You won’t be able to get an access token in a post-login action because it happens before the token is issued. Could you share what you are trying to accomplish here?
I don’t really understand where and how should i invoke these functions of the auth0 instance:
//redirect to the Universal Login Page
document.getElementById('login').addEventListener('click', async () => {
await auth0.loginWithRedirect();
});
//in your callback route (<MY_CALLBACK_URL>)
window.addEventListener('load', async () => {
const redirectResult = await auth0.handleRedirectCallback();
//logged in. you can get the user profile like this:
const user = await auth0.getUser();
console.log(user);
});
Actuall, I am developing in Vite(+React), after changing from Nextjs, so either way it’s not entirely clear do i need to create my own login/signup forms for these functions to work proeprly or I just need to call them? If I only need to call them, then what should I do with the redirectResult?