Asp.Net Identity: invalid_request on redirect when calling REST function GetExternalLogin

asp.net-identity, asp.net-mvc, c#, facebook, javascript

Solution

To set a valid redirect url I had to set it inside the ValidateClientRedirectUri inside the ApplicationOAuthProvider.cs file

Problem

This error applies to the Single Page Application template when selecting the ASP.NET Web Application project in Visual Studio. Add a valid Facebook appId and appSec to the Startup.Auth.cs file to test the demo with external login. I am able to login into Facebook but only if the redirect url which is defined in app.datamodel.js in the js variable siteUrl is set to '/' . As expected, when the call is made to the GetExternalLogin REST function inside the AccountController the user is sent to the Facebook page to do the external login. If I put a breakpoint inside the GetExternalLogin it is triggered as well. However, if I change the siteUrl in the app.datamodel.js to anything else e.g. '/dummyController' the breakpoint is not triggered at all, instead the response gives the message error: invalid_request Any idea why this does not work? Thanks!

Original source

Related problems