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

Calling WebAuthProvider start/await with context that is not an activity throws exception #743

Open
6 tasks done
joknu1 opened this issue May 31, 2024 · 0 comments
Open
6 tasks done
Labels
bug This points to a verified bug in the code

Comments

@joknu1
Copy link

joknu1 commented May 31, 2024

Checklist

Description

This part of the SDK

        @JvmStatic
        internal fun authenticateUsingBrowser(
            context: Context,
            authorizeUri: Uri,
            launchAsTwa: Boolean,
            options: CustomTabsOptions
        ) {
            val intent = Intent(context, AuthenticationActivity::class.java)
            intent.putExtra(EXTRA_AUTHORIZE_URI, authorizeUri)
            intent.putExtra(EXTRA_LAUNCH_AS_TWA, launchAsTwa)
            intent.putExtra(EXTRA_CT_OPTIONS, options)
            intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP)
            context.startActivity(intent)
        }

expects context to be an activity. Otherwise AndroidRuntimeException: Calling startActivity() from outside of an Activity context requires the FLAG_ACTIVITY_NEW_TASK flag. Is this really what you want? is thrown.

Either SDK should expect activity as parameter instead of context, or there should be a way to set what flags to use.

Reproduction

Call

            val credentials = WebAuthProvider
                .login(account)
                .withAudience(audience)
                .withScope(scope)
                .withRedirectUri(redirectUrl)
                .withParameters(parameters)
                .withCustomTabsOptions(getCustomTabsOptions())
                .await(context)

with e.g. applicationContext

Additional context

No response

Auth0.Android version

2.10.2

Android version(s)

14

@joknu1 joknu1 added the bug This points to a verified bug in the code label May 31, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug This points to a verified bug in the code
Projects
None yet
Development

No branches or pull requests

1 participant