Get Started with Flutter Authentication

Perfect! Glad you have it working @regis_mazur!

Howdy, Ike. Let me double check on that and what restrictions you may have when calling the Management API from a client application. :+1:

:zap:Got the answer about Flutter + Auth0 Management API validated by one of our Engineering Managers, Martin Walsh :muscle:

As a public client, the access is limited. This page covers this although it frames it around SPA as an example of a Public Client. Any native app will also be a public client.
Get Management API Access Tokens for Single-Page Applications

1 Like

I was using your GitHub codebase (GitHub - auth0-blog/flutter-authentication: Get Started with Flutter Authentication) to test out the authentication before integrating it with my application and I ran into an issue.
So when I log in the first time, I am redirected to the auth0 domain and can log in successfully. But when I logout and try to log back in, the page that I am supposed to be redirected to does not load. This is what I get:

So then I try to open it in browser,

and I am automatically logged back in without being prompted for my login credentials again…
Is this the intended output? If not, any idea what is going on? Thanks in advance!

1 Like

Hello, Pamelak! Thank you for reading the blog post. Let me please ask you: have you done anything different from the tutorial steps? :thinking: Is your callback set up the same in the Flutter code and the Auth0 app settings in the Dashboard?

I am currently trying to integrate Auth0 into my Flutter application. I followed this tutorial Get Started with Flutter Authentication and I am having some issues. When I try to click the “login” button which triggers the loginAction() method, it does not redirect me to auth0’s domain which would prompt me to enter my username and password. Any idea why this may be happening?

Hey there!

Let me move you message here as this is the thread for working with this exact blogpost.

1 Like

I copied the code from the GitHub repository on the blogpost to ensure that I didn’t do anything different. So yep, the callback is the same in the Flutter code and the Auth0 app settings.

1 Like

Thank you for your response. Let me investigate on that. Is it ok if I get back to you early next week, please?

1 Like

Pamelak, I cloned the repo from the blog post and followed the steps in the README to set it up. It all worked fine :thinking: I could log in and log out without any errors. There may be something in your application creating some sort of conflict.

How to obtain a token to send it by authorization header for example:


Since the token they receive in result.accesToken is short format

1 Like

Martin, there’s a blog post coming up on this topic! Stay tuned please!


We’ll let you know once it’s there!

Thanks for you tutorial. It really helped me get through the basics :). Unfortunately I got stuck on something. For local development I wanted to have a keycloak locally and now I am stuck and error with redirect_url.

Perhaps you could know what to do here?

1 Like

Hello, Macfol! Welcome to the Auth0 Community and thank you for your feedback. Could help me understand, please, what having a “keycloak locally” means? :slight_smile: Thanks!

I created a free account, cloned the repo and tested this Flutter app. I just changed the “Auth0 Variables” to the data for my application. I only tested with the Android emulators. So far I was able to see the Universal Login and insert a user credentials (email + password). Then nothing happens, only a progress indicator. I waited 15 minutes, and nothing. Then I closed the app and launched it again. This time, when clicking on the “login” button, I only get an empty page, like the picture that @pamelak added to his post.
I tried with 2 emulators. Same thing on both.
Then I decided to create my own Flutter project with Android Studio, I used the same code as the one from the demo repo, and I tested again. This time, when I enter the email and password, it returns an “Unauthorized” (Exception happens on “authorizeAndExchangeCode”). When I check the Logs on the Dashboard, I see a Success login followed by a Failed exchange. So, it always failed.

1 Like

Bad configuration on the dashboard perhaps?

1 Like

I just added the Client secret as a parameter to the “appAuth.authorizeAndExchangeCode” method, and then everything worked. What am I doing wrong ? I should not add the client secret inside my mobile app, correct?

1 Like

Howdy, Ed! Welcome to the Auth0 Community and thank you for reading the blog post. Let me bring this question to my team to figure out what could be happening :pray:

1 Like

I know that web support in Flutter is still experimental, but I’m trying to show my customer that we can have an application that works on all platforms AND works like a charm with our recently integrated Auth0 SSO, so that would be really awesome if Auth0 helped Michael with this issue to bring web support to this plugin. Or maybe a native official Auth0 SDK for Flutter?