-
Notifications
You must be signed in to change notification settings - Fork 0
AppAuthHelper
AppAuthHelper contains methods related to logging in and out using flutter_appauth.
You can set all of the parameters such as redirectUrl in static methods on the startup of your application, to save you passing them in later in your app:
void main() {
runApp(const MyApp());
}
...
class _MyAppState extends State<MyApp> {
...
@override
void initState() {
super.initState();
...
AppAuthHelper.setRealm("realm");
AppAuthHelper.setClientId("clientId");
AppAuthHelper.setRedirectUrl("redirectUrl");
AppAuthHelper.setAuthServerUrl("authServerUrl");
...
}Disables the colors for the static AppAuthHelper Log object.
Sets the url that the Auth Helper will redirect to after login. Should match the schema you used in your build files
Sets the client id of the Auth Helper
Sets the keycloak realm used by the Auth Helper
Sets the auth url used by the Auth Helper. For keycloak, should be like: https://keycloak.example.com/auth
Sets the scopes of the Auth Helper
static Future<bool> login({bool tokenLoop, String? redirectUrl, String? clientId, String? realm, String? authServerUrl})
Brings up the Auth Helper. If tokenLoop is true (It defaults to true), on successful login it will start a refresh token loop using Session.startTokenLoop. If the login is successful, will return true. You do not need to pass in the other parameters if they are set using the above setters.
static Future<bool> logout( {String? tokenId, String? redirectUrl, String? clientId, String? realm, String? authServerUrl})
Logs out the current user session. tokenId should be the Id Token of the token you are trying to log out.
static Future<TokenResponse?> refreshToken(String refreshToken, {String? redirectUrl, String? clientId, String? realm, String? authServerUrl})
Gets a new TokenResponse using a refresh token refreshToken. DON'T CALL THIS: unless you are manually handling your session data and not using Session.
Returns the discovery url being used by the Auth Helper.
Models - Currently Empty