Book Image

Cross-platform UI Development with Xamarin.Forms

By : Paul Johnson
Book Image

Cross-platform UI Development with Xamarin.Forms

By: Paul Johnson

Overview of this book

Table of Contents (22 chapters)
Cross-platform UI Development with Xamarin.Forms
Credits
About the Author
Acknowledgments
About the Reviewers
www.PacktPub.com
Preface
Free Chapter
1
In the Beginning…
Index

Using OAuth2


As with Twitter, we will use the Xamarin.Auth package.

The Facebook example in this chapter will need you to first register for the Facebook app and then add a new app. When presented with the option of what to target, select the Advanced option. This allows you to target all the platforms at once. This will give you a secret app ID that is required for OAuth2. You will also need to go to Settings | Advanced, part way down under Client OAuth Redirect, and enter the redirecting URL. This can be any URL that exists for testing purposes. Once the app is ready for the bigger picture, the redirect page should be a page of a website that is not publically accessible.

Note

The source for this part can be found in Chapter13/Facebook.

Virtually, the same code that was used for Twitter can be used for Facebook, but with OAuth2 and not OAuth1. The authenticator looks similar to the following code:

var auth = new OAuth2Authenticator(
clientId: "APP_ID",
scope: "", // permissions
authorizeUrl...