Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Getting login_required Error when audience is added in loginWithRedirect method for web. #482

Open
6 tasks done
murugesh612 opened this issue Nov 11, 2024 · 0 comments
Open
6 tasks done

Comments

@murugesh612
Copy link

murugesh612 commented Nov 11, 2024

Checklist

Description

Getting Error: login_required: Login required when audience is added in the loginWithRedirect.

  Future<void> login() async {
    try {
      if (kIsWeb) {
        return auth0Web.loginWithRedirect(
          redirectUrl: 'http://localhost:3000',
          audience: dotenv.env['AUTH0_AUDIENCE'] 
        );
      }

      var credentials = await auth0
          .webAuthentication(scheme: dotenv.env['AUTH0_CUSTOM_SCHEME'])
          // Use a Universal Link callback URL on iOS 17.4+ / macOS 14.4+
          // useHTTPS is ignored on Android
          .login(useHTTPS: true);

      setState(() {
        _user = credentials.user;
      });
    } catch (e) {
      print(e);
    }
  }

Reproduction

  1. Follow the steps for running the sample app and make the following change.
  • Add audience (obtained from creating API in Auth0 management console).
  1. Try login.

Additional context

No response

auth0_flutter version

1.6.0

Flutter version

3.24.4

Platform

Web

Platform version(s)

No response

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant