diff --git a/auth0_flutter/lib/auth0_flutter_web.dart b/auth0_flutter/lib/auth0_flutter_web.dart index 224188fe..cd9e5085 100644 --- a/auth0_flutter/lib/auth0_flutter_web.dart +++ b/auth0_flutter/lib/auth0_flutter_web.dart @@ -51,7 +51,8 @@ class Auth0Web { final bool? useRefreshTokens, final bool? useRefreshTokensFallback, final String? audience, - final Set? scopes}) async { + final Set? scopes, + final Map parameters = const {}}) async { await Auth0FlutterWebPlatform.instance.initialize( ClientOptions( account: _account, @@ -68,7 +69,8 @@ class Auth0Web { useRefreshTokens: useRefreshTokens, useRefreshTokensFallback: useRefreshTokensFallback, audience: audience, - scopes: scopes), + scopes: scopes, + parameters: parameters), _userAgent); if (await hasValidCredentials()) { diff --git a/auth0_flutter/lib/src/web/extensions/client_options_extensions.dart b/auth0_flutter/lib/src/web/extensions/client_options_extensions.dart index c70a6965..ade2b67c 100644 --- a/auth0_flutter/lib/src/web/extensions/client_options_extensions.dart +++ b/auth0_flutter/lib/src/web/extensions/client_options_extensions.dart @@ -21,7 +21,12 @@ extension ClientOptionsExtension on ClientOptions { useFormData: useFormData, useRefreshTokens: useRefreshTokens, useRefreshTokensFallback: useRefreshTokensFallback, - authorizationParams: JsInteropUtils.stripNulls(AuthorizationParams( - audience: audience, - scope: scopes?.isNotEmpty == true ? scopes?.join(' ') : null))); + authorizationParams: JsInteropUtils.stripNulls( + JsInteropUtils.addCustomParams( + AuthorizationParams( + audience: audience, + scope: scopes?.isNotEmpty == true + ? scopes?.join(' ') + : null), + parameters))); } diff --git a/auth0_flutter_platform_interface/lib/src/web/client_options.dart b/auth0_flutter_platform_interface/lib/src/web/client_options.dart index e7e11836..77334b62 100644 --- a/auth0_flutter_platform_interface/lib/src/web/client_options.dart +++ b/auth0_flutter_platform_interface/lib/src/web/client_options.dart @@ -105,6 +105,9 @@ class ClientOptions { /// Note: The openid scope is always applied regardless of this setting. final Set? scopes; + /// The default additional parameters to be sent to Auth0. + final Map parameters; + ClientOptions( {required this.account, this.authorizeTimeoutInSeconds, @@ -119,5 +122,6 @@ class ClientOptions { this.useRefreshTokensFallback, this.idTokenValidationConfig, this.audience, - this.scopes}); + this.scopes, + this.parameters = const {}}); }