serverpod_auth_idp_flutter library

Provides authentication UI widgets for Serverpod applications.

This library allows developers to integrate authentication flows with various identity providers (email, Google, Apple) into their Flutter apps. It works with the Serverpod auth system and provides ready-to-use UI components.

Classes

AndroidOptions
Specific options for Android platform.
AppleAuthController
Controller for managing Apple-based authentication flows.
AppleOptions
Specific options for Apple platform.
AppleSignInButton
A styled button for Apple Sign-In.
AppleSignInService
Service to manage Apple Sign-In and ensure it is initialized.
AppleSignInStyle
The style of the rendered Apple button.
AppleSignInWidget
A widget that provides Apple Sign-In functionality for all platforms.
AuthenticationKeyManager
Manages keys for authentication with the server.
AuthIdpTheme
Theme for the authentication identity provider UI.
AuthSuccess
Response model representing a successful authentication result with all relevant authentication information.
AuthUser
Core database entity representing a user in the authentication system.
AuthUserModel
DTO for transferring authentication user information.
AvailableIdps
Exposes information about available identity providers.
BadRequestMessage
A message sent when a bad request is received.
Bit
Represents a binary vector, where each element is either true or false.
CachedClientAuthSuccessStorage
Implements the cache layer for a ClientAuthSuccessStorage implementation. The get methods return is cached, so the operation can be performed with no performance concerns.
Caller
ClientAuthKeyProvider
Provides the authentication key for the client.
ClientAuthSuccessStorage
Exposes a method for the session manager to update the AuthSuccess.
CloseMethodStreamCommand
A message sent over a websocket connection to close a websocket stream of data to an endpoint method.
ConnectivityMonitor
Keeps track of internet connectivity and notifies its listeners when the internet connection is either lost or regained. For most use cases, use the concrete FlutterConnectivityMonitor class in the serverpod_flutter package.
DeepCollectionEquality
Deep equality on collections.
EmailAuthController
Controller for managing email-based authentication flows.
EmailSignInWidget
A widget that provides email-based authentication functionality.
EndpointCaller
Super class for all classes that can call a server endpoint.
EndpointRef
This class connects endpoints on the server with the client, it also hooks up streams with the endpoint. Overridden by generated code.
EndpointRefreshJwtTokens
Endpoint for JWT tokens management.
EndpointStatus
Endpoint for getting status and managing a signed in user.
EndpointUserProfileEditBase
Base endpoint for user profile management.
EndpointUserProfileInfo
Endpoint for read-only access to user profile information.
FileUploader
The file uploader uploads files to Serverpod's cloud storage. On the server you can setup a custom storage service, such as S3 or Google Cloud. To directly upload a file, you first need to retrieve an upload description from your server. After the file is uploaded, make sure to notify the server by calling the verifyDirectFileUpload on the current Session object.
FirebaseAuthController
Controller for managing Firebase-based authentication flows.
FirebaseSignInService
Service to manage Firebase Sign-In and ensure it is only initialized once throughout the app lifetime.
FlutterAuthSessionManager
The FlutterAuthSessionManager keeps track of and manages the signed-in state of the user for Flutter applications. Users are typically authenticated with Google, Apple, or other methods. Please refer to the documentation to see supported methods. Session information is stored in the secure shared preferences of the app and persists between restarts of the app.
FlutterSecureKeyValueStorage
A KeyValueStorage wrapper for FlutterSecureStorage.
FlutterSecureStorage
A class to manage secure storage in a Flutter application across multiple platforms.
GoogleAuthController
Controller for managing Google-based authentication flows.
GoogleSignInNativeButton
A styled button for Google Sign-In on native platforms.
GoogleSignInService
Service to manage Google Sign-In and ensure it is only initialized once throughout the app lifetime.
GoogleSignInStyle
The style of the rendered Google button.
GoogleSignInWebButton
A widget that renders the Google Sign-In button for web.
GoogleSignInWidget
A widget that provides Google Sign-In functionality for all platforms.
HalfVector
Represents a vector of half-precision float values.
IOSOptions
Specific options for iOS platform. Currently there are no specific ios options available, but only shared options from apple options.
JwtAuthKeyProvider
The JwtAuthKeyProvider keeps track of and manages the signed-in state of the user for JWT-based authentication.
JwtTokenInfo
DTO for transferring JWT token information between server and client.
KeyValueClientAuthSuccessStorage
Implements the ClientAuthSuccessStorage for key-value based storages.
KeyValueStorage
Basic string-based key/value store interface.
LinuxOptions
Specific options for Linux platform. Currently there are no specific linux options available.
MacOsOptions
Specific options for macOS platform. Extends AppleOptions and adds the usesDataProtectionKeychain parameter.
MethodCallContext
Context for a method call.
MethodStreamMessage
A message sent to a method stream.
MethodStreamSerializableException
A serializable exception sent over a method stream.
ModuleEndpointCaller
This class is used to connect modules with the client. Overridden by generated code.
MutexRefresherClientAuthKeyProvider
A RefresherClientAuthKeyProvider decorator that adds a mutex lock to prevent concurrent refresh calls. Actual auth header getter and refresh logic is delegated to the _delegate provider.
OpenMethodStreamCommand
A message sent over a websocket connection to open a websocket stream of data to an endpoint method.
OpenMethodStreamResponse
A message sent over a websocket connection to respond to an OpenMethodStreamCommand.
PingCommand
A message sent over a websocket connection to check if the connection is still alive. The other end should respond with a PongCommand.
PinTheme
Theme of the individual pin items for following states: default, focused pin, submitted pin, following pin, disabled pin and error pin
PongCommand
A response to a PingCommand.
Protocol
ProtocolSerialization
The ProtocolSerialization defines a toJsonForProtocol method which makes it possible to limit what fields are serialized
RefresherClientAuthKeyProvider
Provides the authentication key for the client, with a method to refresh it.
SasAuthKeyProvider
The SasAuthKeyProvider keeps track of and manages the signed-in state of the user for SAS (Serverpod Auth Session) keys based authentication.
SecureClientAuthSuccessStorage
A ClientAuthSuccessStorage based on FlutterSecureStorage.
SerializableModel
The SerializableModel is the base interface for all serializable objects in Serverpod, except primitives.
SerializationManager
The SerializationManager is responsible for creating objects from a serialization, but also for serializing objects. This class is typically extended by generated code.
ServerpodClientRequestDelegate
Defines the interface of the delegate that performs the actual request to the server and returns the response data. The delegate is used by ServerpodClientShared to perform the actual request. It's overridden in different versions depending on if the dart:io library is available.
ServerpodClientShared
Superclass with shared methods for handling communication with the server. Is typically overridden by generated code to provide implementations of methods for calling the server.
ServerSideSessionInfo
DTO for transferring server-side session information between server and client.
SignInWidget
A widget that provides a complete authentication onboarding experience.
SparseVector
Represents a sparse vector that stores only non-zero elements.
StreamingConnectionHandler
The StreamingConnection handler manages the web socket connection and its state. It will automatically reconnect to the server if the connection is lost. The listener will be notified whenever the connection state changes and once every second when counting down to reconnect. The time between reconnection attempts is specified with retryEverySeconds, default is 5 seconds.
StreamingConnectionHandlerState
Represents the state of the connection handler.
TokenPair
A pair of refresh and access tokens, in their external format.
UserProfile
Core database entity representing a user profile in the authentication system.
UserProfileData
Lightweight DTO to be used as specification while creating a new user profile.
UserProfileImage
Database entity for storing user profile image information.
UserProfileModel
DTO for transferring user profile information.
Uuid
uuid for Dart Author: Yulian Kuncheff Released under MIT License.
UuidValue
Vector
Represents a vector of double values.
WebOptions
Specific options for web platform.
WebSocketMessage
Base class for messages sent over a WebSocket connection.
WebSocketMessageInfo
Interface of WebSocketMessage subclasses that have endpoint, method and connection id info.
WindowsOptions
Specific options for Windows platform.

Enums

AccessControlFlag
Keychain access control flags that define security conditions for accessing items. These flags can be combined to create complex access control policies.
AppleAuthState
Represents the state of the Apple authentication flow.
AppleButtonShape
The shape of the Apple Sign-In button.
AppleButtonSize
The size of the Apple Sign-In button.
AppleButtonText
The type of Apple Sign-In button.
AuthStrategy
Authentication strategies supported the Serverpod authentication core module
CloseReason
The reason a stream was closed.
EmailAuthState
Represents the state of the email authentication flow.
EmailFlowScreen
Represents the different screens in the email authentication flow.
FirebaseAuthState
Represents the state of the Firebase authentication flow.
GoogleAuthState
Represents the state of the Google authentication flow.
GSIButtonLogoAlignment
The alignment of the Google logo. The default value is left. This attribute only applies to the standard button type.
GSIButtonShape
The button shape.
GSIButtonSize
The size of the button to be rendered.
GSIButtonText
The button text.
GSIButtonTheme
The theme of the button to be rendered.
GSIButtonType
The type of button to be rendered.
KeychainAccessibility
KeyChain accessibility attributes as defined here: https://developer.apple.com/documentation/security/ksecattraccessible?language=objc
KeyCipherAlgorithm
Algorithm used to encrypt/wrap the secret key in Android KeyStore.
Namespace
RFC4122 & RFC9562 provided namespaces for v3, v5, and v8 namespace based UUIDs
OpenMethodStreamResponseType
The response to an OpenMethodStreamCommand.
RefreshAuthKeyResult
Represents the result of an authentication key refresh operation.
StorageCipherAlgorithm
Algorithm used to encrypt stored data.
StreamingConnectionStatus
Status of the streaming connection.
ValidationMode
The options for UUID Validation strictness

Extensions

AppleSignInExtension on FlutterAuthSessionManager
Expose convenient methods on FlutterAuthSessionManager.
Base64Dec on String
Extension for decoding ByteData in protocol.
Base64Enc on ByteData
Extension for encoding ByteData in the protocol.
BigIntJsonExtension on BigInt
Expose toJson on BigInt Expose static fromJson builder
BitJsonExtension on Bit
Expose toJson on Bit
ByteDataJsonExtension on ByteData
Expose toJson on ByteData Expose static fromJson builder
CloneBit on Bit
Adds clone method that create a deep copy of a Bit vector.
CloneByteData on ByteData
Adds clone method that create a deep copy of a ByteData.
CloneHalfVector on HalfVector
Adds clone method that create a deep copy of a HalfVector.
CloneSparseVector on SparseVector
Adds clone method that create a deep copy of a SparseVector.
CloneVector on Vector
Adds clone method that create a deep copy of a ByteData.
DateTimeJsonExtension on DateTime
Expose toJson on DateTime Expose static fromJson builder
DisconnectGoogleSignIn on FlutterAuthSessionManager
Expose convenient methods on FlutterAuthSessionManager.
DurationJsonExtension on Duration
Expose toJson on Duration Expose static fromJson builder
FirebaseSignInExtension on FlutterAuthSessionManager
Expose convenient methods on FlutterAuthSessionManager.
FlutterAuthSessionManagerExtension on ServerpodClientShared
Extension for ServerpodClientShared to provide auth session management.
HalfVectorJsonExtension on HalfVector
Expose toJson on HalfVector
IdpExtension on FlutterAuthSessionManager
Extension to provide information about available identity providers.
IdpTheme on ThemeData
Extension on ThemeData to provide easy access to the authentication identity provider theme.
ListJsonExtension on List<T>
Expose toJson on List
MapJsonExtension on Map<K, V>
Expose toJson on Map
SetJsonExtension on Set<T>
Expose toJson on Set
SparseVectorJsonExtension on SparseVector
Expose toJson on SparseVector
UriJsonExtension on Uri
Expose toJson on Uri Expose static fromJson builder
UuidValueJsonExtension on UuidValue
Expose toJson on UuidValue Expose static fromJson builder
VectorJsonExtension on Vector
Expose toJson on Vector

Constants

autoSerializedTypes → const List<String>
All datatypes that are serialized by default. Used internally in Serverpod code generation.
basicAuthSchemeName → const String
The name of the default Serverpod scheme for HTTP "authorization" headers. Note, the scheme name is case-insensitive and should be compared in a case-insensitive manner.
bearerAuthSchemeName → const String
The name of the Bearer scheme for HTTP "authorization" headers. Note, the scheme name is case-insensitive and should be compared in a case-insensitive manner.
extensionSerializedTypes → const List<String>
All datatypes that has extensions to support serialization. Used internally in Serverpod code generation.
hasCloneExtensionTypes → const List<String>
List of types that has a clone method extension and therefore can be copied by calling clone().
immutable → const Immutable
Used to annotate a class C. Indicates that C and all subtypes of C must be immutable.
useResult → const UseResult
Used to annotate a method, field, or getter within a class, mixin, or extension, or a or top-level getter, variable or function to indicate that the value obtained by invoking it should be used. A value is considered used if it is assigned to a variable, passed to a function, or used as the target of an invocation, or invoked (if the result is itself a function).

Properties

nonMutableTypeNames List<String>
List of types that are not mutable and therefore do not need to be copied or handled in a copyWith method.
final

Functions

convertToUserFacingException(Object error) Exception?
Converts server exceptions to user-friendly error messages.
getType<T>() Type
Get the type provided as an generic. Useful for getting a nullable type.
isValidAuthHeaderValue(String value) bool
Returns true if the provided value is a valid HTTP "authorization" header value (which includes starting with an authentication scheme name).
isWrappedBasicAuthHeaderValue(String value) bool
Returns true if the provided value is a Serverpod-wrapped auth key.
isWrappedBearerAuthHeaderValue(String value) bool
Returns true if the provided value is a Bearer auth header value.
unwrapAuthHeaderValue(String? authValue) String?
Returns the auth key from an auth value that has potentially been wrapped. This operation is the inverse of wrapAsBasicAuthHeaderValue and wrapAsBearerAuthHeaderValue. If null is provided, null is returned.
wrapAsBasicAuthHeaderValue(String key) String
Returns a value that is compliant with the HTTP auth header format by encoding and wrapping the provided auth key as a Basic auth value.
wrapAsBearerAuthHeaderValue(String token) String
Returns a value that is compliant with the HTTP auth header format by wrapping the provided token as a Bearer auth value. Unlike Basic auth, Bearer tokens are not Base64 encoded as they are expected to already be in the correct format.

Typedefs

AppleButtonLogoAlignment = IconAlignment
The alignment of the Apple logo. The default value is left.
AppleButtonStyle = SignInWithAppleButtonStyle
The style of Apple Sign-In button.
ConnectivityMonitorListener = void Function(bool connected)
Callback for when internet connectivity changes.
VoidCallback = void Function()
A callback with no parameters or return value.

Exceptions / Errors

AppleIdTokenVerificationException
Exception thrown when Apple ID token verification fails.
AuthHeaderEncodingException
An exception thrown upon erroneous encoding of an auth header.
AuthUserBlockedException
Exception thrown when a user attempts to authenticate but their account is blocked.
AuthUserNotFoundException
Exception thrown when attempting to access an AuthUser that does not exist.
ConnectionAttemptTimedOutException
Thrown if connection attempt timed out.
ConnectionClosedException
Thrown if the connection is closed with an error.
DeserializationTypeNotFoundException
Exception thrown when no deserialization type was found during protocol deserialization
FirebaseIdTokenVerificationException
Exception thrown when Firebase ID token verification fails.
InvalidEmailException
Exception thrown when an email is invalid.
MethodStreamException
Exceptions thrown by the ClientMethodStreamManager.
OpenMethodStreamException
Thrown if opening a method stream fails.
RefreshTokenExpiredException
Exception thrown when attempting to use a refresh token that has expired.
RefreshTokenInvalidSecretException
Exception thrown when a refresh token rotation request has an invalid secret.
RefreshTokenMalformedException
Exception thrown when a refresh token string is malformed or cannot be parsed.
RefreshTokenNotFoundException
Exception thrown when a refresh token cannot be found in the database.
SerializableException
This is SerializableException that can be used to pass Domain exceptions from the Server to the Client
ServerpodClientBadRequest
Thrown if the client created a malformed or invalid request to the server.
ServerpodClientEndpointNotFound
Thrown if the client tries to call an endpoint that was not generated. This will typically happen if getting the endpoint by type while the user has not defined the endpoint in their project.
ServerpodClientException
Exception thrown when errors in communication with the server occurs.
ServerpodClientForbidden
Thrown if the client is forbidden to perform the request. This is typically due to missing permissions.
ServerpodClientGetEndpointException
Thrown if not able to get an endpoint on the client by type.
ServerpodClientInternalServerError
Thrown if the server encountered an internal error. This is typically a bug in the server code.
ServerpodClientMultipleEndpointsFound
Thrown if the client tries to call an endpoint by type, but multiple endpoints of that type exists. The user should disambiguate by using the name parameter.
ServerpodClientNotFound
Thrown if the requested resource was not found on the server.
ServerpodClientUnauthorized
Thrown if the client fails to authenticate and is therefore not authorized to perform the request.
UnknownMessageException
Exception thrown when an unknown message is received.
WebSocketClosedException
Thrown if the WebSocket connection is closed.
WebSocketConnectException
Thrown if the WebSocket connection fails.
WebSocketListenException
Thrown if an error occurs when listening to the WebSocket connection.