external authentication with Oauth using OAuth2Authenticator results in invalid_request

Hello,

I'm working on an app where I will hit my own backend (aspnet webapi) for authentication, using facebook, google etc. I'm testing against a default webapi project to get goinh, but ran into an issue. If I request the providers using Postman, I get the providers I've setup with some url's to reach them. But if I try to convert it into OAuth2Authenticator I get invalid_request. As far as I can see it has something to to with the redirect_url I provide.

The response when I request the providers looks like:
http://192.168.1.234/OLoginAPI/api/Account/ExternalLogin?provider=Facebook&response_type=token&client_id=self&redirect_uri=http://192.168.1.234/

So when I setup OAuth2Authenticator I make something like this:
var auth = new OAuth2Authenticator (
clientId: "self", // your OAuth2 client id
scope: "", // the scopes for the particular API you're accessing, delimited by "+" symbols
authorizeUrl: new Uri ("http://192.168.1.234/OLoginAPI/api/Account/ExternalLogin?provider=Facebook&response_type=token"), // the auth URL for the service
redirectUrl: new Uri ("http://192.168.1.234/login_success.html")); // the redirect URL for the service

I also tried with the facebook clientId. For redirect I tried hitting both the raw url and then the html page.

Can anyone see where this breaks?

If I make a request with Postman to the provided url I get the correct result.

Best regards
Rasmus

Answers

Sign In or Register to comment.