Get Started with Flutter Authentication

Hi, I followed all the steps to enable the refreshToken rotation in Auth0 configuration, but I still get a null refreshToken in my Flutter application. What can be causing this issue?

We’ve managed to solve the problem and get the refresh token, it was a missing configuration in our Auth0 API settings.

In case anyone in the future encounters the same problem, after you follow the Refresh Token Rotation be sure to check your API Access Settings and enable “Allow Offline Access” as written here at the beginning of this guide https://auth0.com/docs/tokens/refresh-tokens.

2 Likes

Thanks for sharing that with the rest of community!

1 Like

Hello, how about authenticating it with the SMS ? Or the One-Time Password?

You mean for the MFA?

This topic was automatically closed 15 days after the last reply. New replies are no longer allowed.

Hi, I read the blog
First Flutter login blog
But I found out that when I press “login” the function

final AuthorizationTokenResponse result =
      await appAuth.authorizeAndExchangeCode(
    AuthorizationTokenRequest(AUTH0_CLIENT_ID, AUTH0_REDIRECT_URI,
        issuer: 'https://$AUTH0_DOMAIN',
        scopes: <String>['openid', 'profile', 'offline_access'],
        promptValues: ['login'],
        additionalParameters: map),
  );

Is called. The problem is that a chrome page is open on my mobile phone, but I wish to do it natively.
Is it possible to get a token and login without opening the web browser?
I went to:
https://github.com/auth0-samples/auth0-android-sample/tree/embedded-login/01-Embedded-Login
found on this blog:

But this link is broken and not exists.

Thank you!

Moving your post to this thread as this one is related with the blog article you referenced

For those who struggle with “activity not found”.
Check the instruction how to change manifest.xml - Changes needed when targetting SDK 30+ · Issue #599 · openid/AppAuth-Android · GitHub

Thanks for sharing it with the rest of community!

Hi, using the code from the example in the blog,
I tried to change the expirationDateTime of the access token but every time I request it, it has 24 hours.
I’m using this code:

      final AuthorizationTokenResponse result =
          await appAuth.authorizeAndExchangeCode(
        AuthorizationTokenRequest(AUTH0_CLIENT_ID, AUTH0_REDIRECT_URI,
            issuer: 'https://$AUTH0_DOMAIN',
            scopes: <String>['openid', 'profile', 'offline_access'],
            promptValues: ['login'],
            additionalParameters: map),
      );

On the Auth0 console i go Applications->Applications->flutterdemo (which is my demo app)
and there is no Access token expiration parameters there.
Only on Applications->Api, and there I set it to be 30 seconds but It still has a day lifetime.
Maybe I should related the Api to the app in some way?

Dear all, first of all thanks for this amazing framework that help us a lot in the Auth0 integration.

I have been facing an issue with Apple were my are was rejected due the translation of “Sign In with Apple” to pt-BR. The Auth0 translation standard is “Continuar com Apple” but accordingly to Apple’s guideline the right translation must be “Continuar com a Apple”. I found a possible solution using Customizing Login Text Prompts (Customize New Universal Login Text Prompts) but I could not found how to do that using flutter_appauth. I have been looking for a possible solution for weeks without success.

I really appreciate if some one could give me some help on this.

Thanks in advance!
Bira

Thank you for this sample code.
But I have question: use the sample code we can authentication by auth0, after authentication how to share authentication info to browser(like safari ,chrome etc) or WebViewController_flutter.
That is to say how to skip auth0 authentication by browser after app auth0 authentication is OK?

Hello,

I have tried to run the sample Fluttr App as well as one created following your nice & clear blog. However, when I try to logion on either I am getting the error:

ERROR:flutter/runtime/dart_vm_initializer.cc(41)] Unhandled Exception: MissingPluginException(No implementation found for method webAuth#login on channel auth0.com/auth0_flutter/web_auth)
#0 MethodChannel._invokeMethod (package:flutter/src/services/platform_channel.dart:313:7)

or on yours:
flutter: login error: MissingPluginException(No implementation found for method webAuth#login on channel auth0.com/auth0_flutter/web_auth) - stack: #0 MethodChannel._invokeMethod (package:flutter/src/services/platform_channel.dart:313:7)
flutter:
flutter: #1 MethodChannel.invokeMapMethod (package:flutter/src/services/platform_channel.dart:518:43)

I am a Flutter newbie so I am not able to fix this myself.
I have tried flutter clean & then flutter run but it makes no difference

Hi @stevef1uk, thanks for reaching out.

Sorry for the late response, I’ve been trying to simulate your issue, and there’s something that get’s my attention, but first I’d like to confirm with you what platform are you targeting when loading your Flutter app?

As a quick reminder, the Flutter Auth0 SDK currently supports iOS and Android devices, but won’t work on Flutter for Web.

Just to make sure, here are the steps I followed to set up my project while testing:

  1. Cloned the repo from: GitHub - auth0-blog/flutter-authentication: Get Started with Flutter Authentication
  2. Replaced the holders for domain and client id on the main.dart file with the values from the Auth0 Dashboard (line 157)
  3. Run the app on the iOS simulator
  4. Click the log in button on the app
  5. Switched the Auth0 Universal Login Page to Sign up and completed the steps
  6. After all was done I was redirected back to the app.

Thanks,
Juan

1 Like

Hello,

I have tried to run the sample Flutter Application on an Android device emulator, but I got some errors with this message: “login error: a0.sdk.internal_error.unknown: Received error with code a0.sdk.internal_error.unknown” after login and return to the app

Could you please help me find out the issue ?

Thanks

I found an issue where android was giving me the following error after adding manifestPlaceholders

Attribute application@name at AndroidManifest.xml:4:9-42 requires a placeholder substitution but no value for <applicationName> is provided.

The solution for this is

using += instead of just =.

       manifestPlaceholders += [
            auth0Domain: "dev-hi4wj8ayswlwbsl5.us.auth0.com",
            auth0Scheme: "auth0app",
        ]

Flutter version

Flutter 3.10.6 • channel stable • ssh://git@github.com/flutter/flutter.git
Framework • revision f468f3366c (3 days ago) • 2023-07-12 15:19:05 -0700
Engine • revision cdbeda788a
Tools • Dart 3.0.6 • DevTools 2.23.1
1 Like