newuser-da3ef876-35f0-4481-874b-7aab95efdc98 avatar image

Call back error differentiation on LWA authorization in iOS


in authorize api callback of LWA in iOS i am getting error object in both cases when user simply cancel login by pressing 'done' button without entering credentials. And when user disagree(cancel) 'privacy notice' by pressing cancel after entering credentials. in both cases i am getting error object with error code 3 and 4. and in both case userDidCancel is true.

I have to differentiate in both cases. currently i am doing this by using error codes. I think in second case error object should not be nil. Please correct me if i am doing anything wrong. And suggest me the better option to differentiate both cases.


<code>- (IBAction)onLogInButtonClicked:(id)sender {
  // Build an authorize request.
  AMZNAuthorizeRequest *request = [[AMZNAuthorizeRequest alloc] init];
    	request.scopes = [NSArray arrayWithObjects:
    	// [AMZNProfileScope userID],
    	[AMZNProfileScope profile],
    	[AMZNProfileScope postalCode]];

  // Make an Authorize call to the Login with Amazon SDK.
  [[AMZNAuthorizationManager sharedManager] authorize:request
    withHandler:^(AMZNAuthorizeResult *result, BOOL
    userDidCancel, NSError *error) {
    	  if (error) {
      		// Handle errors from the SDK or authorization server.
    	  } else if (userDidCancel) {
      		// Handle errors caused when user cancels login.
    	  } else {
      		// Authentication was successful.
      		// Obtain the access token and user profile data.
      		NSString *accessToken = result.token;
      		AMZNUser *user = result.user;
      		NSString *userID = user.userID;

Thanks and Regards

Usman Ansari

login with amazonios
1 comment
10 |5000

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Ross@Amazon avatar image Ross@Amazon ♦♦ commented ·

Hi Usman Ansari,

Can you please provide the error logs that you are receiving?

0 Likes 0 ·

0 Answers