This example demonstrates how to process authenticated requests on the OData service. The main idea is to override the DataService.OnStartProcessingRequest method and implement authenticated logic in it.
To access this service, use the following credentials:
UserName: John
Password: qwerty
See also:
OData and Authentication – Part 6 – Custom Basic Authentication
Salt (cryptography)
How to send authenticated requests to the OData service
How to: Use the XPO OData V3 Service
Question Comments
Added By: Jay Patel 15 at: 9/24/2013 11:33:27 AM
I was wondering why this project is not compatible with Visual Studios Ultimate 2010? Thanks
Added By: Joseph Tang 3 at: 10/10/2013 7:57:30 AMI used your code with the modification that it would check the AD for authentication. It works. However, it always popup the login window for entering the username and password.
Added By: Pedro Coutinho 1 at: 11/28/2013 3:22:33 AMHow can i get the userinfo from the database?
Added By: Pedro Coutinho 1 at: 11/29/2013 7:09:31 AMHow can i retrieve this users from a database?
Added By: George Yoder at: 1/25/2014 1:19:44 PMHow would you do authentication with sql membership provider????
Added By: Enderson Salas at: 7/29/2014 4:26:35 PMThis example no compile in Visual Studio 2013 because some assembly references are missing.
Added By: Nikolai (DevExpress Support) at: 7/30/2014 4:23:50 AMHello,
To process your recent post more efficiently, I created a separate ticket on your behalf: T135174: E4403 is not compiled in Visual Studio 2013. This ticket is currently in our processing queue. Our team will address it as soon as we have any updates.
Hello Dev express team,
Can you please explain me how to get my the user information from our DB, we use The Profile provider in ASP.NET Membership & Users, and how to integrated to this Authentication process?
************************* YOUR SAMPLE CODE************************
namespace MyDataService {
public class CustomBasicAuth {
class UserInfo {
public string Name { get; set; }
public string PasswordHash { get; set; }
public string[] Roles { get; set; } }
static UserInfo[]
Users = new[] { new UserInfo {
Name = "John",
PasswordHash = "F3U89ry4+MMXyqbbT90tcs18J5Y=",
Roles = new[] { "User", "Admin" } } };
************************************************************************
My Tables:
aspnet_Users:
UserID
UserName
aspnet_Membership:
UserID
Password (encripted)
aspnet_Roles:
RoleID
RoleDescripcion
aspnet_UsersInRoles:
UserID
RoleID
Regards
Pedro Perez
Hello Pedro,
To process your recent post more efficiently, I created a separate ticket on your behalf: T262586: How to select users from DB in authenticated data service. This ticket is currently in our processing queue. Our team will address it as soon as we have any updates.
When I debug this webservice and go to this link http://localhost:65443/MyDataService.svc. It throw an error 'Invalid login or password'. How can I access this service? I don't know how to use UserName: John, Password: qwerty you gave me.
Added By: Nikolai (DevExpress Support) at: 11/29/2015 11:51:43 PM Hi,This example is intended for How to send authenticated requests to the OData service. It demonstrates how to send user credentials to the server side.Added By: Hari Setyawan 2 at: 6/14/2016 3:25:21 AM How do you connect the authentication with the view html and js and also the data in the database?Added By: Nikolai (DevExpress Support) at: 6/14/2016 6:47:14 AM
Hello Hari,
I've created a separate ticket on your behalf (T391925: How to implement authentication). It has been placed in our processing queue and will be answered shortly.