nimatra
nimatra

Reputation: 614

What is the url for Facebook authentication with WebAuthenticationCoreManager

I have this code for Facebook authentication

var scopes = "email user_birthday user_events user_friends user_about_me";
WebAccountProvider facebookAccountProvider = 
      await WebAuthenticationCoreManager
            .FindAccountProviderAsync("https://www.facebook.com/dialog/oauth");
WebTokenRequest webTokenRequest = new WebTokenRequest(facebookAccountProvider, scopes);

WebAuthenticationCoreManager does not like Facebook OAuth endpoint https://www.facebook.com/dialog/oauth and sets my facebookAccountProvider to null. Does anyone know how I can get FindAccountProviderAsync working with Facebook?

Upvotes: 2

Views: 428

Answers (1)

Nick Darvey
Nick Darvey

Reputation: 1149

WebAuthenticationCoreManager.FindAccountProviderAsync() finds account providers that have been registered with Windows. This means (say) the Facebook app would need to support it (which it doesn't). At the moment it's only useful for Microsoft accounts and organizational accounts (Office 365/Azure AD).

If you want to use Facebook's OAuth 2.0 implementation directly you can use WebAuthenticationBroker instead (there are examples on that page).

Upvotes: 2

Related Questions