AppAuthHelper class abstract
This class can be used to log in using a FlutterAppAuth. It contains several helper methods
and stores a lot of parameters statically to help set up the project.
Keep in mind this is designed specifically with keycloak in mind and
has not been tested with other auth providers
Properties
- hashCode → int
-
The hash code for this object.
no setterinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited
Static Properties
- discoveryUrl → String
-
no setter
Static Methods
-
disableColors(
) → void - Disable the colors in the logs if your terminal does not support escape codes
-
login(
{bool tokenLoop = true, String? redirectUrl, String? clientId, String? realm, String? authServerUrl}) → Future< bool> -
Will open up a browser showing the authentication provider and attempt to get a token. Returns true on a successful token.
Calls Session.onToken on success so you can get your token from Session.token.
Setting
tokenLoopto true will automatically make it call Session.startTokenLoop on successful login -
logout(
{String? tokenId, String? redirectUrl, String? clientId, String? realm, String? authServerUrl}) → Future< bool> - Logs the user out, based on the given tokenId. Will automatically grab the one from Session by default Returns true on successful logout
-
refreshToken(
String refreshToken, {String? redirectUrl, String? clientId, String? realm, String? authServerUrl}) → Future< TokenResponse?> - Refreshes the token using the given refresh token. By default, does not update the session. DON'T CALL THIS: Unless you are manually handling session data
-
setAuthServerUrl(
String authServerUrl) → void - Sets the base auth server url, eg: https://keycloak.example.com/auth
-
setClientId(
String clientId) → void - Sets the client id of your application within keycloak
-
setRealm(
String realm) → void - Sets the keycloak realm of your project
-
setRedirectUrl(
String redirectUrl) → void - Sets the redirecturl that will be called once login is complete. Should match the redirect url you set in build.gradle
-
setScopes(
List< String> scopes) → void - Sets the scopes