OAuthWidget constructor
- required Key key,
- dynamic onAuth() = _defaultOnAuth,
- dynamic onAuthCode(
- AuthCodeData data,
- bool isCompletion
- dynamic onError() = _defaultOnError,
- Set<
OAuth> oAuths = const {...OAuth.values}, - OAuthButtonConfiguration buttonConfig = const OAuthButtonConfiguration(),
- OAuthWidgetTheme theme = OAuthWidgetTheme.system,
- UIAuthParams authParams = const UIAuthParams._(),
Constructs a OAuthWidget with OAuths.
There are some parameters, that you can provide. key
can be used to retrieve State of the widget.
onAuth
will be called after successful auth if you passed PublicFlowData to authParams
.
onAuthCode
will be called if you passed ConfidentialFlowData to authParams
instead of PublicFlowData. This function provides AuthCodeData that should be used on your server side to get AccessToken and RefreshToken. isCompletion
indicates that the method onAuth
won't be called.
onError
will be called if any error was encountered during auth.
oAuths
specifies OAuth providers. By default, all providers will be shown.
buttonConfig
allows to configure OAuth buttons.
theme
allows to configure widget theme.
authParams
specify auth flow and scopes. Read more about them in UIAuthParamsBuilder.
Implementation
const OAuthWidget({
required Key key,
Function(OAuth? oAuth, AuthData accessToken) onAuth = _defaultOnAuth,
Function(AuthCodeData data, bool isCompletion) onAuthCode =
_defaultOnAuthCode,
Function(OAuth? oAuth, AuthError error) onError = _defaultOnError,
Set<OAuth> oAuths = const {...OAuth.values},
OAuthButtonConfiguration buttonConfig = const OAuthButtonConfiguration(),
OAuthWidgetTheme theme = OAuthWidgetTheme.system,
UIAuthParams authParams = const UIAuthParams._(),
}) : _onAuth = onAuth,
_onAuthCode = onAuthCode,
_onError = onError,
_oAuths = oAuths,
_buttonConfig = buttonConfig,
_theme = theme,
_authParams = authParams,
super(key: key);