Domanda

I have a C# MVC5 website on Azure in which I'm trying to add a variety of identity providers (e.g. Google, Twitter, Facebook, Microsoft).

Having followed a simple guide on the asp.net site on adding Microsoft Live as an authentication option, I'm finding that when I try to authenticate with a Live account, I'm always bounced to my login page. My site users should instead be directed to the "Register" (MYSITE.azurewebsites.net/Account/Register) page upon first successful authentication from a new provider, or to the home page as an authenticated user if previously registered. However, I seem to always be sent to the login page.

I'm not encountering any authentication errors from the Live provider - username and password are being accepted and the provider does seem to be redirecting as if an authentication was successful.

I haven't encountered this problem when integrating with Facebook, Google or Twitter.

In the Live Connect Developer Center, where my authentication app is configured, I'm required to provide a "redirect domain":

You only need to enter the domain, for example http://www.contoso.com

For this I've entered the URL for my Azure site http://MYSITE.azurewebsites.net The field doesn't appear to acknowledge any routes such as /Account/Something/ on the end of the URL, but I'm not clear that it should need to.

Does anyone know if I require some additional configuration in my site to work with Microsoft Live or is there some restriction on using the Live provider on free Azure sites?

È stato utile?

Soluzione

I've fixed this. Unfortunately it transpired that I was missing a preceding hyphen character from my clientSecret which I had specified in my StartUp.Auth.cs

I'm surprised an error wasn't thrown to say that the client secret was invalid, as I was going on the assumption that any incorrect clientId or clientSecret values would have rejected my request when clicking the 'login with Microsoft' button.

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top