This is why I am here. Let's take this step by step :)
.env file in the root of the directory.http://localhost:3000/api/v1/user/auth. This is our API endpoint that will be used to authenticate the user.http://localhost:3000/api/v1/user/auth to your .env file as a value to DISCORD_REDIRECT_URI.identify scope and the guilds scope..env file as a value to PUBLIC_DISCORD_AUTH_URI. This is the URL the user will be redirected to, when they click the "discord" button.client ID and client secret from the General settings tab (OAuth2->General) and add them to your .env file.It should look something like this:
DISCORD_REDIRECT_URI=""
PUBLIC_DISCORD_AUTH_URI=""
DISCORD_OAUTH_CLIENT_ID=""
DISCORD_OAUTH_CLIENT_SECRET=""
DISCORD_REDIRECT_URI with your domain name instead of localhost:3000Login with Discord button and they get redirected to PUBLIC_DISCORD_AUTH_URI.DISCORD_REDIRECT_URI, which is just a SvelteKit endpoint. Discord will append a code query parameter that we can use to get user data from Discord's API.sessionHandler) and save the user data in it. Creating a session will return us a random ID that will be send back to the user as a cookie, just as we redirect them to /dashboard. That is so...dashboard folder), they send the cookie(automatically), then the cookie gets parsed in /src/hooks.ts, and then authorized in the /src/routes/dashboard/__layout.svelte.localhost:3000/dashboard should display the user's Discord ID.FullUser, is the authenticated user's access token properties(GrantData) and user information properties(UserData), in one type.Contributions welcome ♥
Just open a new pull request.