Skip to content
Back

Discord OAuth2 (Flutter, RiverPod, Pt.2)

  • 0
  • Android
  • Flutter
  • Auth
  • Cloud
theLazyPragmatic
25 Jan, 2025, 16:21

I build a tiny little App that lets you login with your Google or Discord Account and greets you with your username if logged in. Code is here: https://github.com/theLazyPragmatic/oauthtest

so, I haven't figured out Riverpod yet, so you have to reload the app in order to see the greeting. This issue is not about that (although I am more than happy if someone shows me whats wrong). BUT: Redirecting from google signin does work as expected, redirecting from discord does not. Both providers received the same redirect-uri from the appwrite console during setup. Discord also creates a user / a session in appwrite - after authorizing, the browser gets briefly redirected to cloud.appwrite.io, but then immediately back to discord.

TL;DR
Developers are discussing issues with Discord OAuth2 integration in their Flutter app, particularly regarding the redirection back to the app after authorization. Some propose using material routes, avoiding Riverpod, or rebuilding the page after login. The core problem seems to be the lack of redirect for Discord, unlike Google. One developer shares their test app for reference. In the end, the issue remains unresolved, with Discord not redirecting properly after authorization.
theLazyPragmatic
27 Jan, 2025, 10:00

@D5 thanks for looking into it.

D5
27 Jan, 2025, 12:02

After redirect, you can route. You don't need to use riverpod

D5
27 Jan, 2025, 12:02

Just material route

theLazyPragmatic
27 Jan, 2025, 12:49

...But I want to use riverpod and I don't want a new route, I want this page to be rebuilt. Routing back to the page after login/logout feels like a clever hack, but a cheat nontheless.. (and it does not work...)

The core problem, however, is that - for Discord - there is no redirect. Browser: Discord.com -> "Authorize" -> cloud.appwrite.io -> Discord.com -> "Authorize" etc. At least google redirects back (but does not rebuild page.)

D5
27 Jan, 2025, 13:00

After the GetX experience, I recommend sticking to native/flutter parts if possible. Using riverpod for displaying data is great and I do that. However in your case, you should route after login to a different page instead of changing/hiding the existing widget

D5
27 Jan, 2025, 13:01

Hmm I think all the ouath providers redirect back to the app, right?

theLazyPragmatic
27 Jan, 2025, 13:31

Docs say they should. MyApp says they don't.

D5
27 Jan, 2025, 13:42

But only for Discord? Google returns back to the app?

theLazyPragmatic
27 Jan, 2025, 13:46

Yes.

Reply

Reply to this thread by joining our Discord

Reply on Discord

Need support?

Join our Discord

Get community support by joining our Discord server.

Join Discord

Get premium support

Join Appwrite Pro and get email support from our team.

Learn more