Patrick Dunn
Patrick Dunn

Reputation: 100

Azure Mobile Services Custom Identity Provider from Javascript App

I am trying to implement a custom identity provider in Azure Mobile services and I am using an HTML5/JS app to consume it. I am following Josh Twists post on the matter and I have it set up per his instructions. His blog post consumes the new identity table via objC.

I'm very new to this so please bear with me if it's something mundane that I missed. I apologize in advance.

I have successfully consumed other tables in the AMS using JS but this one is returning a Server 500 error. I have updated the Master Key with my own. And added the accounts table and the script he specifies on the insert function for that table.

Here's the JS I am using to try to call the table:

var item = {
        username: $("#username").val(),
        passowrd: $("#password").val(),
        salt: "1234",
        login: true
    };
    client.getTable("accounts").insert(item);

In this case client is my MobileServiceClient and I use the same client.getTable("").insert(obj) to insert into other tables and it works just fine.

One thing I do notice in the insert script I got from the blog is that it says there's an unexpected use of |= and ^.

function slowEquals(a, b) {
var diff = a.length ^ b.length;
    for (var i = 0; i < a.length && i < b.length; i++) {
        diff |= (a[i] ^ b[i]);
    }
    return diff === 0;
}

If anyone could help me understand where I am going wrong I would greatly appreciate it. Thank you for taking the time to read this.

EDIT: Thanks Josh. Didn't realize the logs were there. Ended up being an issue of not getting length of undefined... it was undefined because I passed passowrd instead of password. Thanks for your quick help.

Upvotes: 1

Views: 602

Answers (1)

Josh Twist
Josh Twist

Reputation: 36

Have you checked the logs (in the management portal) for details of the 500 error? Also, I have a web implementation here - http://doto.mobi/web (it's the web version of http://doto.mobi).

You can view source and see that it uses custom identity. It's not exactly the same backend but pretty close, should be a good head start.

Upvotes: 2

Related Questions