This is a migrated thread and some comments may be shown as answers.

How to bind ListView to Secure Web API (MVC 4) / How to send Username/Password or API-Key with the API call that decorated with [Authorize]

1 Answer 98 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
mo2011ti
Top achievements
Rank 1
mo2011ti asked on 26 Dec 2012, 10:54 AM
Hi,

I know it's not completely a classic Kendo issue, but I believe most of us want answer for that, so please kindly share your experience and a solution if you have one.

I'm able to bind ListView to Web API (MVC 4)

I'm using the ICENIUM by the way...

var productTransport = new kendo.data.RemoteTransport({
    read: {
        url: "http://localhost:1822/api/products",
        dataType: 'jsonp',  
        type: 'GET'
    }
});
 
var datasource = new kendo.data.DataSource({
    transport: productTransport
});
 
  $("#MyListView").kendoMobileListView({
        dataSource: datasource,
        template: kendo.template($("#listviewHeadersTemplate").html())
    });
That works fine!

Now I want to secure the API call and want to send Username/Password with the API call in Cross Domain (after all its mobile app...)

1) the user (on the mobile app) need to enter his username/password when application launch.
2) I need to Authenticate the user with an API call for Login... if user pass the authentication, Return some ApiKey
3) this APIKey need to be sent on every API call that is secure and decorated with [Authorize]

Do you have a solution for this?

I attach Web API project, Please fill free to modify it to achieve that.
I'm 3 days on that and read lot of documentation, so any help is appreciated.

Thanks

Moti

1 Answer, 1 is accepted

Sort by
0
Atanas Korchev
Telerik team
answered on 28 Dec 2012, 07:25 AM
Hi,

 We can't help with implementing user authentication because it would be very specific to your business logic and authentication service implementation.

 If you want to send arguments to a remote service you should use the data setting of the transport.read:

read: {
        url: "http://localhost:1822/api/products",
        dataType: 'jsonp',  
        data: { token: myToken},
        type: 'GET'
    }


Regards,
Atanas Korchev
the Telerik team
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
Tags
General Discussions
Asked by
mo2011ti
Top achievements
Rank 1
Answers by
Atanas Korchev
Telerik team
Share this question
or