none
Unable to authenticate with Microsoft Account using Azure Mobile Services RRS feed

  • Question

  • Hello,

    I've recently released an application with support of Microsoft, Facebook and Google login. For a first few days everything was okay, but since yesterday my users unable to login with Microsoft Account.

    If I try to login the following happens:

    - I enter my Microsoft account email and password and click the login button. 

    - Nothing happens

    - I click the login button again 

    - I get the following error: "Invalid account or password. Try again"

    - When I reenter my password and click the login button again I get the following error:

    "Login failed: Error: Redirect from microsoftaccount does not contain the required wams_state cookie."

    I migrated the Mobile service to the App Services but it didnt help. I checked all my settings, and codes with no luck.

    I would appreciate if someone could help me figure out the solution.

    Thanks in advance,

    Henrik

    Saturday, July 2, 2016 1:55 PM

Answers

  • Is your app a UWP app by any chance?  UWP is not supported for the Azure Mobile Services client SDKs. 

    Otherwise, you can try this workaround here: https://github.com/Azure/azure-mobile-services/issues/891.

    If you're using UWP, you should upgrade your client and server code to use Azure Mobile Apps instead. For a list of the Mobile Services vs. Mobile Apps client SDKs, see Client and server versioning in Mobile Apps and Mobile Services.

    • Marked as answer by henrikbarna Wednesday, July 6, 2016 8:37 AM
    Tuesday, July 5, 2016 11:55 PM
    Moderator

All replies

  • Hi,

    Thank you for posting here!

    We are checking on the query and would get back to you soon on this.

    I apologize for the inconvenience and appreciate your time and patience in this matter.

    Regards

    Sunday, July 3, 2016 7:55 AM
  • Hello Henrik,

    The similar type of query has been discussed here, Kindly refer the steps which might help you to resolve the issue and let us know the status.

    Reference: https://social.msdn.microsoft.com/Forums/en-US/6bbdb774-29ba-4205-ba97-8d22de4c4795/login-failed-error-redirect-from-microsoftaccount-does-not-contain-the-required-wamsstate-cookie?forum=azuremobile&prof=required

    Hope this helps.

    Regards,

    Swikruti

    If a post answers your question, please click Mark as Answer on that post and Vote as Helpful.

    Monday, July 4, 2016 7:01 AM
  • Is your app a UWP app by any chance?  UWP is not supported for the Azure Mobile Services client SDKs. 

    Otherwise, you can try this workaround here: https://github.com/Azure/azure-mobile-services/issues/891.

    If you're using UWP, you should upgrade your client and server code to use Azure Mobile Apps instead. For a list of the Mobile Services vs. Mobile Apps client SDKs, see Client and server versioning in Mobile Apps and Mobile Services.

    • Marked as answer by henrikbarna Wednesday, July 6, 2016 8:37 AM
    Tuesday, July 5, 2016 11:55 PM
    Moderator
  • Hello,

    Thanks for your help. I upgraded to the App Service Mobile Apps and almost everything seems to be okay.

    One more question if I may.

    I used a custom API to get extra user information after a successful login, but now its not working with the new App Service.

    My code was the following:

    exports.get = function(request, response) {
        var user = request.user;
        var url;
        user.getIdentities({
            success: function(identities) {
                if (identities.google) {
                    var googleAccessToken = identities.google.accessToken;
                    url = 'https://www.googleapis.com/oauth2/v3/userinfo?access_token=' + googleAccessToken;
                } else if (identities.facebook) {
                    var fbAccessToken = identities.facebook.accessToken;
                    url = 'https://graph.facebook.com/me?fields=id,email,name,gender&access_token=' + fbAccessToken;
                } else if (identities.microsoft) {
                    var liveAccessToken = identities.microsoft.accessToken;
                    url = 'https://apis.live.net/v5.0/me/?method=GET&access_token=' + liveAccessToken;
                }
                var requestCallback = function(err, resp, body) {
                    if (err || resp.statusCode !== 200) {
                        console.error('Error sending data to the provider: ', err);
                        response.send(statusCodes.INTERNAL_SERVER_ERROR, body);
                    } else {
                        try {
                            var userData = JSON.parse(body);
                            response.send(200, userData);
                        } catch (ex) {
                            console.error('Error parsing response from the provider API: ', ex);
                            response.send(statusCodes.INTERNAL_SERVER_ERROR, ex);
                        }
                    }
                }
                var req = require('request');
                var reqOptions = {
                    uri: url,
                    headers: { Accept: "application/json" }
                };
                req(reqOptions, requestCallback);
            }
        });
    }

    And I get the following error:

    Cannot read property 'getIdentities' of undefined

    Would you be so kind to help me solve this problem too?

    Thank you so much in advance.

    Have a greate day,

    Henrik

    Wednesday, July 6, 2016 8:37 AM
  • Authentication works differently in Mobile Apps, so you should follow this article: How to: Use authentication claims with your tables
    Wednesday, July 6, 2016 9:32 PM
    Moderator