Get Started with Flutter Authentication

We are definitely looking into it. Thank you again for creating that Pull Request :pray:

2 Likes

Fantastic news, I was waiting for this for some times. Thanks.

1 Like

Is it possible to add a specific audience for this Flutter authentication?

1 Like

quick question, can we access the management api using the token received throughout the blog?

1 Like

you can set it in additionalParameters like this:

AuthorizationTokenRequest(
AUTH0_CLIENT_ID,
AUTH0_REDIRECT_URI,
issuer: AUTH0_ISSUER,
additionalParameters: {‘audience’: ‘<your_audience>’},
scopes: [‘openid’, ‘email’, ‘profile’, ‘offline_access’, ‘api’],
discoveryUrl: ‘$AUTH0_ISSUER/.well-known/openid-configuration’,
),

1 Like

Thank you arch18.
I have now resolved my issue using a different approach.

2 Likes

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

Hello,
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?

Hello,
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:

eyJ0eXAiOiJKV1QiLCJhbGciOiJSUzI1NiIsImtpZCI6Ik1qSTRRVFEwT1VRNU9VSXlSVEV6TlRBd05UVXpSVVExTlVOR05FVkVORGRDTlRnM016VXdRZyJ9.eyJodHRwczovL2JpdG9vbXRyYWRlci5uZXQvYXV0aG9yaXphdGlvbiI6eyJncm91cHMiOlsiQ29uc3VtZXJzIl0sInJvbGVzIjpbIlVzZXIiXX0sImlzcyI6Imh0dHBzOi8vYml0em9vbS5hdXRoMC5jb20vIiwic3ViIjoiYXV0aDB8NWNhNTE5NzZjYzMzZjUxMTBhYWNkYmM0IiwiYXVkIjpbImh0dHBzOi8vYml0em9vbS5hdXRoMC5jb20vYXBpL3YyLyIsImh0dHBzOi8vYml0em9vbS5hdXRoMC5jb20vdXNlcmluZm8iXSwiaWF0IjoxNTU5MzIzNDI1LCJleHAiOjE1NTk0MDk4MjUsImF6cCI6IlliRGFSelRVQkFtZEFrSExqdjZ0bEI3U05xSTF1RlNtIiwic2NvcGUiOiJvcGVuaWQgcHJvZmlsZSBlbWFpbCBhZGRyZXNzIHBob25lIHJlYWQ6Y3VycmVudF91c2VyIHVwZGF0ZTpjdXJyZW50X3VzZXJfbWV0YWRhdGEgZGVsZXRlOmN1cnJlbnRfdXNlcl9tZXRhZGF0YSBjcmVhdGU6Y3VycmVudF91c2VyX21ldGFkYXRhIGNyZWF0ZTpjdXJyZW50X3VzZXJfZGV2aWNlX2NyZWRlbnRpYWxzIGRlbGV0ZTpjdXJyZW50X3VzZXJfZGV2aWNlX2NyZWRlbnRpYWxzIHVwZGF0ZTpjdXJyZW50X3VzZXJfaWRlbnRpdGllcyIsImd0eSI6InBhc3N3b3JkIn0.St7097L1ZAlBWcAPrie-8CGV2F3Fr8uNYpSDVKSPVPF4zBZrmm62_UAj7Ssux8AjUy0LhjiF3kLpNph2L7yrpUREw6TyGJwQasfdVtM5VzRYUcy-fOGyRSqPQorbzxJQZzs2pyDJm-2hMQ0McJ37ubKIWrHFD5McMedN6THK7g5TExX47XCRPcOuCEWm3bf3zdWF2LEGhCw_c-lcZDwlb4ePkO721XjSWtrXEBvxc8scFNaHDt7VOnrSze4XK_LO8eE8bHRq6qUrWf1csYucK--aHazBsvfdl-6QDRk-tOBM-LdXJMT7H8Ih6trxVmZofQjr2dQ4j_3DTVoU3eLdog

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!

2 Likes

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

Hi,
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