The Bidco LoginManager provides a secure and easy way for people to log into your app and manage their Bidco Profile.

To facilitate seamless engagement, you can create an temporary profile for users that do not have an existing Bidco profile. This temporary profile requires no personal user information upfront because the profile is tied to the device.

The temporary profile can later be saved allowing the user to use their newly created Bidco account across multiple devices. However, if the application is deleted or the data is cleared before the profile is saved the account will be irrevocably lost.

The LoginManager can be used to do the following:

Note: For those using RxJava, all the methods described below are available in the RxLoginManager

Log In as a Guest

A temporary or guest user profile lets you build a frictionless Bidco experience by allowing users to start making payments without requiring a Bidco account. Guest accounts are deleted after an hour of inactivity.


  1. Log in as an anonymous guest user using the LoginManager:
LoginManager loginManager = ManagerFactory.getInstance().getLoginManager();
loginManager.signInAsGuest(new PowaTagCallback<AccessToken>() {
	public void onSuccess(AccessToken accessToken) {
		// Guest user is now logged in
		Profile profile = ManagerFactory.getInstance().getProfileManager().getCurrentProfile();
		Baskets baskets = ManagerFactory.getInstance().getBasketsManager().getCurrentBaskets();
	}
	public void onError(PowaTagException exception) {
	}
});
  1. The access token for the currently authenticated user can be retrieved using:
AccessToken accessToken = ManagerFactory.getInstance().getLoginManager().getCurrentAccessToken(); 

Note: To make the guest profile permanent, all that is needed is to update the profile with some details and then save it. For details on how to do this read User Profiles


Log into an Existing Bidco Profile

An existing Bidco user can log in and immediately begin making payments using the payment instruments stored in their Bidco profile.

There are four ways an existing user can log in using the SDK:

  1. Log In Using a Profile ID
ProfileIdSignInDetails profileIdSignInDetails = new ProfileIdSignInDetails( signInDiag.getProfileId(), signInDiag.getPassword());
LoginManager loginManager = ManagerFactory.getInstance().getLoginManager();
loginManager.signIn(profileIdSignInDetails, new PowaTagCallback<Profile>() {
	public void onSuccess(Profile profile) {
		// User is now logged in
		Profile profile = ManagerFactory.getInstance().getProfileManager().getCurrentProfile();
		Baskets baskets = ManagerFactory.getInstance().getBasketsManager().getCurrentBaskets();
	}
}

  1. Log In Using a Mobile Number
MobileNumberSignInDetails mobileNumberSignInDetails = new MobileNumberSignInDetails( signInDiag.getMobileNumber(), signInDiag.getPassword());
	LoginManager loginManager = ManagerFactory.getInstance().getLoginManager();
	loginManager.signIn(mobileNumberSignInDetails, new PowaTagCallback<Profile>() {
		public void onSuccess(Profile profile) {
			// User is now logged in
			Profile profile = ManagerFactory.getInstance().getProfileManager().getCurrentProfile();
			Baskets baskets = ManagerFactory.getInstance().getBasketsManager().getCurrentBaskets();
		}
	}

Note: It is only possible to log in using a mobile number if the profile has been updated with one.


  1. Log In Using an Email Address
EmailSignInDetails emailSignInDetails = new EmailSignInDetails( signInDiag.getEmail(), signInDiag.getPassword());
LoginManager loginManager = ManagerFactory.getInstance().getLoginManager();
loginManager.signIn(emailSignInDetails, new PowaTagCallback<Profile>() {
	public void onSuccess(Profile profile) {
		// User is now logged in
		Profile profile = ManagerFactory.getInstance().getProfileManager().getCurrentProfile();
		Baskets baskets = ManagerFactory.getInstance().getBasketsManager().getCurrentBaskets();
	}
}

Note: It is only possible to log in using an email address number if the profile has been updated with one.


  1. Log In Using a Proxy UserId

You are able to use your own application identifier for the current user to log in.

ProxyUserIdSignInDetails proxyUserIdSignInDetails = new ProxyUserIdSignInDetails( sysConfig.getUserId(), sysConfig.getPassword());
LoginManager loginManager = ManagerFactory.getInstance().getLoginManager();
loginManager.signIn(proxyUserIdSignInDetails, new PowaTagCallback<Profile>() {
	public void onSuccess(Profile profile) {
		// User is now logged in
		Profile profile = ManagerFactory.getInstance().getProfileManager().getCurrentProfile();
		Baskets baskets = ManagerFactory.getInstance().getBasketsManager().getCurrentBaskets();
	}
}

Note: It is only possible to log in using the proxyUserId if one has been set in the profile.


For details on the getter and setter methods available please see the SDK reference documentation.


After Logging In

Once the user is logged in you can retrieve and modify the Profile, detect Bidco tags that trigger different workflows.


Checking if the User is Logged In

  1. Check if the user is logged in:
if (ManagerFactory.getInstance().getLoginManager().isLoggedIn()) {
	// User is already logged in
} else {
	// Go to login screen
}

Log Out

Log out from the current profile, removing the current AccessToken, baskets and profile data from memory. If the current profile is a temporary profile, all personal user information associated with that account will be deleted.

  1. Log out using LoginManager:
LoginManager loginManager = ManagerFactory.getInstance().getLoginManager();
loginManager.logout(new PowaTagCallback<Void>() {
     public void onSuccess(Void result) {
       // User is now logged out
     }
     public void onError(PowaTagException exception) {
     }
});

Samples

To see detailed authentication examples, import the Sample App app and review the WelcomeActivity class.