Skip to content

Conversation

@pmathew92
Copy link
Contributor

@pmathew92 pmathew92 commented Jan 21, 2026

Description

This PR adds the allowedBrowsers parameter to the logout method of the WebAuthentication class, bringing it to parity with the login method.

Closes #724

Changes

  • Added allowedBrowsers parameter to WebAuthentication.logout() method

Tests

  • Added unit tests for allowedBrowsers in web_authentication_test.dart
  • Added unit tests in method_channel_auth0_flutter_web_auth_test.dart
  • Added unit tests in LogoutWebAuthRequestHandlerTest.kt

Usage Example

import 'package:auth0_flutter/auth0_flutter.dart';

final auth0 = Auth0('YOUR_DOMAIN', 'YOUR_CLIENT_ID');

// Logout with specific allowed browsers (Android only)
await auth0.webAuthentication().logout(
  allowedBrowsers: [
    'com.android.chrome',
    'com.chrome.beta',
    'com.chrome.dev',
    'org.mozilla.firefox',
  ],
);

Behavior

  • When the user's default browser is in the allowlist, it uses the default browser
  • When the user's default browser is not in the allowlist but another allowed browser is installed, that browser is used instead
  • When no allowed browser is installed, an error is returned
  • If allowedBrowsers is empty (default), no browser restrictions are applied

Checklist

  • All existing tests pass
  • New tests added for the feature
  • Code follows existing patterns in the codebase

NandanPrabhu
NandanPrabhu previously approved these changes Jan 21, 2026
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR adds the allowedBrowsers parameter to the logout method of the WebAuthentication class, bringing it to parity with the existing login method. This Android-only feature enables developers to specify an allowlist of browser packages for the logout operation.

Changes:

  • Added allowedBrowsers parameter to Dart's WebAuthentication.logout() method and WebAuthLogoutOptions class
  • Updated Android's LogoutWebAuthRequestHandler to handle allowedBrowsers and configure CustomTabsOptions with BrowserPicker
  • Added comprehensive unit tests across Flutter and Android platforms

Reviewed changes

Copilot reviewed 9 out of 9 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
auth0_flutter/lib/src/mobile/web_authentication.dart Added allowedBrowsers parameter to logout() method signature and implementation
auth0_flutter_platform_interface/lib/src/web-auth/web_auth_logout_options.dart Added allowedBrowsers field to WebAuthLogoutOptions class and included it in toMap() serialization
auth0_flutter/android/src/main/kotlin/com/auth0/auth0_flutter/request_handlers/web_auth/LogoutWebAuthRequestHandler.kt Implemented allowedBrowsers handling using CustomTabsOptions and BrowserPicker
auth0_flutter/test/mobile/web_authentication_test.dart Added three test cases covering different scenarios for allowedBrowsers parameter
auth0_flutter_platform_interface/test/method_channel_auth0_flutter_web_auth_test.dart Added tests for allowedBrowsers serialization and default behavior
auth0_flutter/android/src/test/kotlin/com/auth0/auth0_flutter/LogoutWebAuthRequestHandlerTest.kt Added three Kotlin unit tests for allowedBrowsers handling
auth0_flutter/example/android/app/build.gradle Updated manifest placeholders to use string resources instead of hardcoded values
auth0_flutter/example/android/app/src/main/res/values/strings.xml.example Deleted example configuration file

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@pmathew92 pmathew92 merged commit 728bda5 into main Jan 21, 2026
11 of 13 checks passed
@pmathew92 pmathew92 deleted the feat/allowed_browser_logout branch January 21, 2026 11:38
@pmathew92 pmathew92 changed the title feat: Add allowedBrowsers parameter to logout API [SDK-724] feat: Add allowedBrowsers parameter to logout API Jan 21, 2026
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

Successfully merging this pull request may close these issues.

Logout ignores allowedBrowsers and uses default browser (Firefox)

4 participants