Discord OAuth and Bot integration types

Is it possible in some way to handle complete flow for bot installs, out of the box? See below authorize url, it works to install on servers but the flow, in comparison to user login, that initiates with POST/sign-in/social creating a state for security that is passed forwarded to verify response later on That is great of course, but bots are unable to sign in to initiate such state and breaks when the callback requires said state
https://discord.com/oauth2/authorize
?client_id=<botId>
&permissions=<botPermissionBits>
&response_type=code
&redirect_uri=http%3A%2F%2Flocalhost%3A3000%2Fapi%2Fauth%2Fcallback%2Fdiscord
&integration_type=0
&scope=identify+email+guilds+bot
https://discord.com/oauth2/authorize
?client_id=<botId>
&permissions=<botPermissionBits>
&response_type=code
&redirect_uri=http%3A%2F%2Flocalhost%3A3000%2Fapi%2Fauth%2Fcallback%2Fdiscord
&integration_type=0
&scope=identify+email+guilds+bot
Below is the local output after above flow is completed and sending queries back to the redirect_uri
2025-05-24T22:22:11.476Z ERROR [Better Auth]: State not found undefined
GET /api/auth/callback/discord?code=<code>&guild_id=<guildId>&permissions=<permissionBits> 302 in 11ms
GET /api/auth/error?error=state_not_found 200 in 5ms
2025-05-24T22:22:11.476Z ERROR [Better Auth]: State not found undefined
GET /api/auth/callback/discord?code=<code>&guild_id=<guildId>&permissions=<permissionBits> 302 in 11ms
GET /api/auth/error?error=state_not_found 200 in 5ms
Also I might be doing this wrong, just touching base on discord app development
0 Replies
No replies yetBe the first to reply to this messageJoin

Did you find this page helpful?