cancel
Showing results for 
Search instead for 
Did you mean: 

Null sessionToken returned in mobileDeviceLoginSucceeded

I'm in the process of going between step4 and step5 of https://developer.authorize.net/integration/fifteenminutes/ios

 

It seems that the sessionToken is being returned as null !

 

  1. What should be done about this?
  2. Has the sessionToken been deprecated?
  3. Should name and password be part of every CreateTransactionRequest's merchantAuthentication object?

 

Here's some proof that its null:

MobileDeviceLoginResponse: MobileDeviceLoginResponse.anetApiResponse = ANetApiResponse.refId = (null)
ANetApiResponse.messages = Messages.resultCode = Ok
Messages.message = (
    "Message.code = I00006\nMessage.text = The mobile device is approved and ready for use.\nMessage.description = (null)\n"
)
MobileDeviceLoginResponse.sessionToken = (null)

 

And here's why that trips me up:

Create Transaction response
The element 'merchantAuthentication' in namespace 'AnetApi/xml/v1/schema/AnetApiSchema.xsd' has incomplete content. List of possible elements expected: 'name, transactionKey, sessionToken, password' in namespace 'AnetApi/xml/v1/schema/AnetApiSchema.xsd'

 

fermyon123
Member
1 ACCEPTED SOLUTION

Accepted Solutions

I confirm that the solution above is correct. I commented out the registration code

the second time and left the login code and the session now is no longer null.

 

//[an mobileDeviceRegistrationRequest:mobileDeviceRegistrationRequest];
    [an mobileDeviceLoginRequest: mobileDeviceLoginRequest];

 

Thanks to everyone! Now does anyone know what the next steps are?

 

 

View solution in original post

10 REPLIES 10

The session token has absolutely not been deprecated.  I can't say that I fully understand the first block of code that you posted, but it doesn't appear to me that you are actually running the mobileDeviceLoginRequest in this sample and instead you are going directly to reading the mobileDeviceLoginResponse.  It is true that the token would appear to be null in this scenario.

Trevor
Administrator Administrator
Administrator
  • Thanks for confirming tha the sesionToken has not been deprecated!
  • The first block is not code but it is a cut-out from the logs that Xcode generates when running the project, the logs are actually dumped by the AuthNet binary and not me. This is very helpful as I don't have to go around placing log statements on my own. If the log statment isn't showing up, then its because the binary does not log that request.
    ...
MobileDeviceLoginRequest *mobileDeviceLoginRequest = [MobileDeviceLoginRequest mobileDeviceLoginRequest]; mobileDeviceLoginRequest.anetApiRequest.merchantAuthentication.name = @"username"; mobileDeviceLoginRequest.anetApiRequest.merchantAuthentication.password = @"password"; mobileDeviceLoginRequest.anetApiRequest.merchantAuthentication.mobileDeviceId = [[[UIDevice currentDevice] uniqueIdentifier] stringByReplacingOccurrencesOfString:@"-" withString:@"_"]; // Set up an AuthNet instance. AuthNet *an = [AuthNet getInstance]; [an setDelegate:self]; // Process a mobile device registration request. [an mobileDeviceRegistrationRequest:mobileDeviceRegistrationRequest]; // Process a mobile device login request. [an mobileDeviceLoginRequest:mobileDeviceLoginRequest];

 

  • As you can see, I am actually running the mobileDeviceLoginRequest in this sample:
  • [an mobileDeviceLoginRequest:mobileDeviceLoginRequest];
  • I'm not going directly to reading the response, having said that, here's the full log ... please help :) and like I said I don't know why the binary chooses not to log that mobileDeviceLoginRequest ... there's no way I could have created its associated response object on my own which is getting logged, its the binary doing the work here...
2012-03-22 20:40:47.391 Mobile Device Login Response

2012-03-22 20:40:47.392 <?xml version="1.0" encoding="utf-8"?><mobileDeviceRegistrationResponse xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="AnetApi/xml/v1/schema/AnetApiSchema.xsd"><messages><resultCode>Ok</resultCode><message><code>I00006</code><text>The mobile device is approved and ready for use.</text></message></messages></mobileDeviceRegistrationResponse>

2012-03-22 20:40:47.394 Error = (null)

2012-03-22 20:40:47.395 Message: 
Message.code = I00006
Message.text = The mobile device is approved and ready for use.
Message.description = (null)

2012-03-22 20:40:47.396 Messages: 
Messages.resultCode = Ok
Messages.message = (
    "Message.code = I00006\nMessage.text = The mobile device is approved and ready for use.\nMessage.description = (null)\n"
)

2012-03-22 20:40:47.397 MerchantContact = MerchantContact.merchantName = (null)
MerchantContact.merchantAddress = (null)
MerchantContact.merchantCity = (null)
MerchantContact.merchantState = (null)
MerchantContact.merchantZip = (null)
MerchantContact.merchantPhone = (null)

2012-03-22 20:40:47.398 MobileDeviceLoginResponse: MobileDeviceLoginResponse.anetApiResponse = ANetApiResponse.refId = (null)
ANetApiResponse.messages = Messages.resultCode = Ok
Messages.message = (
    "Message.code = I00006\nMessage.text = The mobile device is approved and ready for use.\nMessage.description = (null)\n"
)


MobileDeviceLoginResponse.sessionToken = (null)
MobileDeviceLoginResponse.merchantContact = MerchantContact.merchantName = (null)
MerchantContact.merchantAddress = (null)
MerchantContact.merchantCity = (null)
MerchantContact.merchantState = (null)
MerchantContact.merchantZip = (null)
MerchantContact.merchantPhone = (null)

MobileDeviceLoginResponse.userPermissions = (
)

2012-03-22 20:40:47.403 Create Transaction Request:
<?xml version="1.0" encoding="utf-8"?><createTransactionRequest xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="AnetApi/xml/v1/schema/AnetApiSchema.xsd"><merchantAuthentication></merchantAuthentication><transactionRequest><transactionType>authCaptureTransaction</transactionType><amount>1.00</amount><payment><creditCard><cardNumber>4111111111111111</cardNumber><expirationDate>1212</expirationDate><cardCode>100</cardCode></creditCard></payment><order></order><lineItems><lineItem><itemId>1</itemId><name>Soda</name><description>Soda</description><quantity>1</quantity><unitPrice>1.00</unitPrice><taxable>false</taxable></lineItem></lineItems><tax><amount>0</amount><name>Tax</name></tax><shipping><amount>0</amount><name>Shipping</name></shipping><customer></customer><billTo></billTo><shipTo></shipTo><transactionSettings></transactionSettings><userFields></userFields></transactionRequest></createTransactionRequest>

2012-03-22 20:40:47.685 Create Transaction response
2012-03-22 20:40:47.686 <?xml version="1.0" encoding="utf-8"?><ErrorResponse xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="AnetApi/xml/v1/schema/AnetApiSchema.xsd"><messages><resultCode>Error</resultCode><message><code>E00003</code><text>The element 'merchantAuthentication' in namespace 'AnetApi/xml/v1/schema/AnetApiSchema.xsd' has incomplete content. List of possible elements expected: 'name, transactionKey, sessionToken, password' in namespace 'AnetApi/xml/v1/schema/AnetApiSchema.xsd'.</text></message></messages></ErrorResponse>

2012-03-22 20:40:47.688 Message: 
Message.code = E00003
Message.text = The element 'merchantAuthentication' in namespace 'AnetApi/xml/v1/schema/AnetApiSchema.xsd' has incomplete content. List of possible elements expected: 'name, transactionKey, sessionToken, password' in namespace 'AnetApi/xml/v1/schema/AnetApiSchema.xsd'.
Message.description = (null)

 

Any thoughts? Did the paste overload scare folks away?

The active posters on the forum don't integrate mobile devices, I'm afraid. I'm a PHP guy myself.

That's cool, so from even a PHP client perspective, what reason can you think of to get back a null sessionToken?

In the spirit of sharing, I wrote a comprehensive mobile device setup tutorial:

part 1 - http://pulkitsinghal.blogspot.com/2012/03/authnet-ios-integration.html

part 2 - http://pulkitsinghal.blogspot.com/2012/03/authnet-ios-integration-part-2.html

 

But I still need the community's help to get over that last wall of the null sessionToken :)

I know that this is a late response, but I wanted to follow up since this thread never really got a resolution.  It appears that the issue here came down to a conflict between the design of the SDK and the way that you were trying to use it.  The current implementation of the iOS SDK does not allow concurrent requests.  Your code is running the mobileDeviceLoginRequest before the mobileDeviceRegistrationRequest has been completed and closed out.  Simply changing the request pattern should resolve the null response.

I confirm that the solution above is correct. I commented out the registration code

the second time and left the login code and the session now is no longer null.

 

//[an mobileDeviceRegistrationRequest:mobileDeviceRegistrationRequest];
    [an mobileDeviceLoginRequest: mobileDeviceLoginRequest];

 

Thanks to everyone! Now does anyone know what the next steps are?

 

 

Hey Did You Solve This Proble...I also Get this typeOutput..i m Stuck At here,,,i  also get null SessionToken On MobileDeviceLoginSucceed ...Is There Any Solution.....??????????????????:(

 

 

Reply.....