The Bidco PTKLoginManager 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 PTKLoginManager can be used to do the following:

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 a guest user:
PTKLoginManager *loginManager = [PTKLoginManager sharedManager];
[loginManager signInAsGuestWithCompletion:^(PTKAccessToken *accessToken, NSError *error) {
	if (accessToken) {
		// User is now logged in
		PTKProfile *profile = [PTKProfileManager sharedManager].currentProfile;
		PTKBaskets *baskets = [PTKBasketsManager sharedManager].currentBaskets;
	}
}];

  1. The access token for the currently authenticated user can be retrieved using:
PTKAccessToken *accessToken = [PTKLoginManager sharedManager].currentAccessToken;

Log into an Existing Bidco Profile

A existing PowaTag 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
PTKLoginManager *loginManager = [PTKLoginManager sharedManager];
PTKProfilIdSignInDetails *signInDetails = [PTKProfileIdSignInDetails profileIdSignInDetailsWithProfileId:@"profileId" password:@"Password"];
[loginManager signInWithProfileId:signInDetails completion:^(PTKProfile *currentProfile, NSError *error) {
	if (error) {
		// Handle error.
	} else {
		// Handle login success.
	}
}];
  1. Log In Using a Mobile Number
PTKLoginManager *loginManager = [[PTKManagerFactory sharedManager] loginManager];
PTKMobileNumberSignInDetails *signInDetails = [PTKMobileNumberSignDetails mobileNumberSignInDetailsWithMobileNumber:@"71234567"
																									   password:@"Password"];

[loginManager signInWithMobileNumber:signInDetails completion:^(PTKProfile *currentProfile, NSError *error) {
	if (error) {
		// Handle error.
	} else {
		// Handle login success.
	}
}];

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
PTKLoginManager *loginManager = [PTKLoginManager sharedManager];
PTKEmailSignInDetails *signInDetails = [PTKEmailSignInDetails emailSignInDetailsWithEmail:@"email@email.com"
							password:@"Password"];

[loginManager signInWithEmail:signInDetails
completion:^(PTKProfile *currentProfile, NSError *error) {
	if (error) {
		// Handle error.
	} else {
	// Handle login success.
	}
}];

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.

PTKLoginManager *loginManager = [PTKLoginManager sharedManager];
PTKProxyUserIdSignInDetails *signInDetails = [PTKProxyUserIdSignInDetails proxyUserId:@"10000001"
							password:@"Password"];

[loginManager signInWithProxyUserId:signInDetails completion:^(PTKProfile *currentProfile, NSError *error) {
	if (error) {
		// Handle error.
	} else {
	// Handle login success.
	}
}];

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 that is included as part of the SDK.


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 has a current access token:
if ([PTKLoginManager sharedManager].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 PTKLoginManager:
[loginManager logoutWithCompletion:^(NSError *__nullable error) {
	if (error) {
		// Handle error
	} else {
		// Logout success.
	}
}];

Sample

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