Forum Xamarin Cross Platform with Xamarin

OAuth + Forms + PCL with Xamarin.Auth

BSalitaBSalita USMember

Xamarin.Auth is a great component for programming OAuth. However, it isn't Forms and PCL friendly. I've created a GitHub project which demonstrates how to use a wrapper class to expose Xamarin.Auth functionality for use with Forms and PCL.

Synopsis: Complete C# cross-platform mobile app. Demonstrates requesting of OAuth credentials enabling execution of APIs. Implements Xamarin.Auth in Xamarin.Forms in a natural, PCL-like way. Uses JSON data file to provide a selection of OAuth logins. Providers include Amazon, Facebook, Google, and many more.

1. Easy and powerful implementation of Xamarin.Auth in Xamarin.Forms.
2. Complete C# cross-platform mobile app [not yet].
3. Use Xamarin.Auth as if it was a native PCL library. No need to push logic into platform dependent files.
4. Demonstrates usage of most Xamarin.Auth members.
5. Compatible with (most) OAuth1 and OAuth2 providers.
6. Uses an easily configurable embedded JSON file to drive execution. File contains OAuth providers, credentials, URLs and much more.
7. Working examples of calling many different OAuth providers.
8. Contains necessary logic to support quirky OAuth implementations.
9. Easily adaptable Xamarin.Auth implementation ready for inclusion in your projects.
10. Wraps Xamarin.Auth in PCL for easy use.
11. Designed to be compatible with existing and future versions of Xamarin.Auth.
12. Easy way to test OAuth implementations. Simply enter a new OAuth provider implementation in the JSON file.
13. Demonstrates use of saving/reusing/deleting credentials to minimize repeated authentications.
14. Demonstrates use of refreshing expired authorizations [not yet].
15. Demonstrates use of binding to Xamarin.Forms controls.
16. Easier to use than WebView and non-PCL solutions.
17. Complete source code provided. No restrictions on use.


  • stvansolanostvansolano UMInsider, University ✭✭✭

    Definitely will give it a try! Thanks for sharing!

  • tohweitohwei USMember ✭✭

    Any example of using Xamarin Auth's OAuth2Request to do 'POST' , or post status to LinkedIn's Share API?
    I encountered an issue of posting object via OAuth2Request.
    The currrent parameters object is "Dictionary<string, string>". I have no problem of using this to post with a flat value (string, string).

    But I need to post something like this now:
    "comment": "Check out!",
    "visibility": {
    "code": "anyone"

    ANy idea>?

  • tohweitohwei USMember ✭✭

    Achived via normal post through httpClient.

  • RandeepSinghRandeepSingh AUMember ✭✭

    Can you please advise how can we get user profile details such as name and user id. Do we have to depend on redirect uri here? I saw the PerformAuth2TestRequests , but guess it would be different for each provider. Anything uniform here?

  • BSalitaBSalita USMember

    @RandeepSingh: Yes, every API provider has a different provider. Every endpoint is different. It's too bad there's no standardization so that every API has

  • MathiesonSterlingMathiesonSterling USMember ✭✭

    In the readme notes, it says this is Android only. Is this still the case?

  • BSalitaBSalita USMember

    iOS is untested. How does this happen? I didn't have a Xamarin license for iOS.

  • CodyCody USMember ✭✭

    Does anyone get a bug where if you fail the login with xamarin.auth facebook, and then login successfully, it takes you right to your facebook feed? It doesn't seem to call auth.completed when this happens as well.

  • zahikramerzahikramer ILMember ✭✭✭

    Does someone knows if Xamarin.Auth is working these days? Updated?

  • foluisfoluis USMember ✭✭

    Broken link -->

Sign In or Register to comment.