I implemented OAuth authorization in a .Net Web Api project following this tutorial. I need to do the same, but within an Azure Mobile App project. It is published and everything works fine like a Web Api until I try to authenticate my calls to the controllers. When I add the authorize attribute and I call the api, I am supposed to send a bearer token. Please note that I do this using PostMan with my Web Api project and everything works perfect. But, in the Azure Mobile Application, every time that I call a controller with the authorize attribute using the right bearer token, it comes back with the "authorization has been denied for this request" error. The code between the web api project and the azure mobile application project is exactly the same with the only exception been in the startup class.
Web Api startup.cs:
public partial class Startup
{
public void Configuration(IAppBuilder app)
{
ConfigureAuth(app);
}
)
Azure Mobile Application startup.cs:
public partial class Startup
{
public void Configuration(IAppBuilder app)
{
ConfigureMobileApp(app);
ConfigureAuth(app);
}
}
I think that the problem has to do with the ConfigureMobileApp function, as it has some authentication code within itself, but I am not sure. I am not used to the start up class. Still kinda noob with it.
So, every call to the web api project using the bearer token, works fine. Every call to the azure mobile application project using the bearer token, comes back with the "authorization has been denied for this request" error.
What can I do to workaround this???
Thank you!!

