wibarr
wibarr

Reputation: 276

Google Authentication in single page application returns invalid_request when running on azure compute emulator

I have recently created a new Azure web role for a cloud service using the ASP.NET MVC5 Single Page Application template and also configured it to allow Google to be used for auth. When I deploy the service to Azure everything works as expected and I can successfully authenticate with Google.

However, when I'm trying to develop on my local machine, I just get an invalid_request response from Google whenever I try to authenticate. I've narrowed this down to the fact that Google doesn't consider a return URL of 127.0.0.1:81 to be valid. Is there any way around this?

Upvotes: 0

Views: 71

Answers (1)

Gaurav Mantri
Gaurav Mantri

Reputation: 136366

Not really an answer to your question but I ran into exact same issue in my application as well though mine is an MVC 5 Application. In my case, the problem is caused by Windows Azure Caching Session State Provider. If I have the following lines of code in my web.config file, the authentication simply does not work.

<sessionState mode="Custom" customProvider="AFCacheSessionStateProvider">
  <providers>
    <add name="AFCacheSessionStateProvider" type="Microsoft.Web.DistributedCache.DistributedCacheSessionStateStoreProvider, Microsoft.Web.DistributedCache" cacheName="default" dataCacheClientName="default" applicationName="AFCacheSessionState"/>
  </providers>
</sessionState>

The moment I comment the above XML, everything works great. Not sure why this is happening but I thought I would share my findings with you.

Please see if this is not the case with you.

Upvotes: 0

Related Questions