Android client custom login Azure Mobile service (.NET Back end) RRS feed

  • Question

  • I am asking the same question here that I posted on StackOverFlow yesterday

    have followed the steps in the following documentation and built my .NET backend - I have been able to get the mobile service's new CustomRegistration and CustomLogin functions operational using the "try this out" button on the respective api pages at localhost:<portNumber>/help/Api/POST-api-CustomLogin and ../CustomRegistration. I have published these channges to the service to my azure mobile services.

    I am then attempting to connect to the service using an android app that I am building in Android Studio. I am very new to Android and as a result I'm having difficulty getting my app to use the CustomLogin provided by my mobile service. Below the code for the Android APP

    In the java/com.example.howzit folder:

    package com.example.howzit;
    public class LoginResult {
        public String AuthenticationToken;
        // Summary:
        //     Gets or sets the Microsoft.WindowsAzure.Mobile.Service.Security.LoginResultUser
        //     logged in.
        public LoginResultUser User;

    package com.example.howzit;
    public class LoginResultUser {
        public String UserId ;
    package com.example.howzit;
        public class LoginRequest
            public String username ;
            public String password ;
    In the TodoActivity class I have this:
    mClient = new MobileServiceClient(
                        this).withFilter(new ProgressFilter())
                .withFilter(new RefreshTokenCacheFilter());
            LoginRequest loginUser = new LoginRequest();
                loginUser.username = "theUserName";
                loginUser.password = "thePassword";
                    mClient.invokeApi("CustomLogin",loginUser,LoginResult.class, new ApiOperationCallback<LoginResult>() {
                        public void  onCompleted(LoginResult result,Exception error, ServiceFilterResponse  response ){
                            if (error != null) {
                                        createAndShowDialog(error, "Error");
                                    else {
                                        createAndShowDialog(result.User.UserId, "User");

    I have debugged this and it basically hits the invokeApi call and continues to load the rest of the app never hitting the onCompleted routine...In Android Studio I have access to the LogCat, but there is nothing on there to inform me of an error. I'm really unable to get to the bottom of this. I have successfully implemented the Google login provider as well as the Window Azure provider, but am unable to with my own custom login. Any help would be greatly appreciated.

    more info:. I have set up remote debugging on VS2013 and if I remove the authentication and debug, break points are hit when using the android app, but the when using the Authentication the CustomLogin Post in the Controller is never hit.

    Friday, September 26, 2014 5:32 PM