Authenticate your users

Create your auth instance

This instance is used to manage authentication with Viafoura

VFAuthService auth = ViafouraSDK.auth();
val auth = ViafouraSDK.auth()

Get user auth status

Retrieve the current user auth status.

auth.getUserLoginStatus(new AuthService.UserLoginStatusCallback() {
    @Override
    public void onSuccess(boolean userIsLoggedIn, String userUUID) {

    }
});
auth.getUserLoginStatus(object: AuthService.UserLoginStatusCallback {
    override fun onSuccess(userIsLoggedIn: Boolean, userUUID: String) {

		}
})

Logout

Log the user out.

auth.logout();
auth.logout()

Basic login

Perform basic login with e-mail and password.

auth.login(email, password, new AuthService.LoginCallback() {
    @Override
    public void onSuccess(LoginResponse loginResponse) {

    }

    @Override
    public void onError(NetworkError err) {

    }
});
auth.login(email, password, object: AuthService.LoginCallback {
    override fun onSuccess(loginResponse: LoginResponse) {

    }

    override fun onError(err: NetworkError) {

    }
})

Basic signup

auth.signup(name, email, password, new AuthService.SignUpCallback() {
    @Override
    public void onSuccess(SignUpResponse loginResponse) {

    }

    @Override
    public void onError(NetworkError err) {

    }
});
auth.signup(name, email, password, new AuthService.SignUpCallback() {
    override fun onSuccess(signupResponse: SignUpResponse) {

    }

    override fun onError(err: NetworkError) {

    }
});

Cookie login

More information about how our cookie login works: Cookie Login

auth.cookieLogin(token, new AuthService.CookieLoginCallback() {
    @Override
    public void onSuccess(LoginResponse loginResponse) {

    }

    @Override
    public void onError(NetworkError err) {

    }
});
auth.cookieLogin(token, "viafouraDefinedCookie", new AuthService.CookieLoginCallback() {
    override fun onSuccess(loginResponse: LoginResponse) {

    }

    override fun onError(err: NetworkError) {

    }
});

OpenID login

More information about how our OIDC login works: OIDC Login

auth.openIdLogin(token, new AuthService.OpenIdLoginCallback() {
    @Override
    public void onSuccess(LoginResponse loginResponse) {

    }

    @Override
    public void onError(NetworkError err) {

    }
});
auth.openIdLogin(token, new AuthService.OpenIdLoginCallback() {
    override fun onSuccess(loginResponse: LoginResponse) {

    }

    override fun onError(err: NetworkError) {

    }
});

Login Radius login

auth.loginRadiusLogin(token, new AuthService.LoginRadiusLoginCallback() {
    @Override
    public void onSuccess(LoginResponse loginResponse) {

    }

    @Override
    public void onError(NetworkError err) {

    }
});
auth.loginRadiusLogin(token, new AuthService.LoginRadiusLoginCallback() {
    override fun onSuccess(loginResponse: LoginResponse) {

    }

    override fun onError(err: NetworkError) {

    }
});

Social login

auth.socialLogin(token, new AuthService.SocialLoginCallback() {
    @Override
    public void onSuccess(SocialLoginResponse loginResponse) {

    }

    @Override
    public void onError(NetworkError err) {

    }
});
auth.socialLogin(token, object: AuthService.SocialLoginCallback {
    override fun onSuccess(loginResponse: SocialLoginResponse) {

    }

    override fun onError(err: NetworkError) {

    }
})

Request password reset

auth.passwordReset(email, new AuthService.PasswordResetCallback() {
    @Override
    public void onSuccess() {

    }

    @Override
    public void onError(NetworkError err) {

    }
});
auth.passwordReset(email, object: AuthService.PasswordResetCallback {
    override fun onSuccess() {
        callback.onSuccess()
    }

    override fun onError(err: NetworkError) {
        callback.onError()
    }
})

What’s Next