I have a webapi that is hosted on Azure. I'm trying to use the App Service authentication service for Google / Facebook. I've got it setup with Google and can see the google login page when I try to access this url
However, if i try to access one of the endpoints, i get an unauthorized error. For example, I'm using the Visual Studio WebAPI template project. It has the following endpoint:
<Error>
<Message>Authorization has been denied for this request.</Message>
</Error>
</div> <div class="line"></div> <div class="line">The controller for that endpoint looks like this (again this is a pre-generated code from the Web API template):</div> <div class="line">
namespace WebApi.Controllers
{
[Authorize]
[RoutePrefix("api/Account")]
public class AccountController : ApiController
{
private const string LocalLoginProvider = "Local";
private ApplicationUserManager _userManager;
public AccountController()
{
}
I believe there needs to be a registration process done first on the webapi backend. For example, to call the following endpoint:
Member
15 Points
47 Posts
Azure App Service Authentication with Google / Facebook - register user on webapi backend
Jul 14, 2016 12:44 AM|solidfish|LINK
I have a webapi that is hosted on Azure. I'm trying to use the App Service authentication service for Google / Facebook. I've got it setup with Google and can see the google login page when I try to access this url
https://myapp.azurewebsites.net/.auth/login/google
Once I login with google, i see all my google information here:
https://myapp.azurewebsites.net/.auth/me
However, if i try to access one of the endpoints, i get an unauthorized error. For example, I'm using the Visual Studio WebAPI template project. It has the following endpoint:
https://myapp.azurewebsites.net/api/Values
That endpoint above gives me this error:
<div class="line"> </div> <div class="line"></div> <div class="line">The controller for that endpoint looks like this (again this is a pre-generated code from the Web API template):</div> <div class="line">I believe there needs to be a registration process done first on the webapi backend. For example, to call the following endpoint:
https://myapp.azurewebsites.net/api/Account/RegisterExternal
Does this registration process need to take place?
If so, how should my client do the POST so it gets through the Azure authentication service?
</div>Member
30 Points
15 Posts
Re: Azure App Service Authentication with Google / Facebook - register user on webapi backend
Jul 21, 2016 01:16 AM|adian_J|LINK
Do you use Azure Ad to authorize your Azure App service? If you have some issue related with Azure Ad, this forum is better for you to get a better support: https://social.msdn.microsoft.com/Forums/azure/en-US/home?forum=WindowsAzureAD