Skip to content

EdHubbell/XamarinFormsOauth2Demo

Repository files navigation

XamarinFormsOauth2Demo

This was based on https://github.com/jsauve/OAuthTwoDemo.XForms, which was published before Xamarin.Forms 1.3.X

Xamarin.Forms 1.3.X allows for the ability to just set a MainPage, which looks like a logical way to do things. For reference, take a look here: http://developer.xamarin.com/guides/cross-platform/xamarin-forms/working-with/app-lifecycle/

This is just a demo that allows you to see all the various config screens that you'll encounter when setting up a Google app. I included the api keys and whatnot, as I don't see any reason not to. It isn't a real app. If you set up your app to use this apps credentials, then you'll probably be bummed when I delete the app from my Google account. Or when I die. Or whatever.

The app starts on a start page that has a button that says 'Log On With Google'. I'd love to get more auth methods in here. I'd especially love to see a demo of native Facebook auth in a Xamarin.Forms app.

Any and all feedback is welcome - There are probably better ways to handle much of this.

Some things that I don't like -

  • Every time there is a login, we're making new pages. Seems like the old ones are probably floating around somewhere, but I don't know how to find a reference to the previous page.
  • Probably should make that google button look decent if we're going to add other login methods.
  • Storing auth in App.Properties - Works as it is global, but probably a better way to do it.

So here are some nice screenshots:

Login Flow

Startup screen - This gives us a place to go back to when someone logs out. If the app starts right out into an Auth page, I think that's a little befuddling. Apologies for the large screen shots - I really don't feel like going back and shrinking them.

Alt text

Alt text

Alt text

This screen is only seen once per authenticating user - Once the user grants permission to the app, subsequent logins won't ask for permissions.

Alt text

Alt text

Google OAuth2 Config Yak Shavin'

Any time you set up a new app, you're going to have to go thru some screens over at https://console.developers.google.com/project I constantly have problems even getting to the correct screens, as my box is constantly logged in to at least 2 gmail addresses at any time.

The redirect address used here is as suggested by a StackOverflow thread here: http://stackoverflow.com/questions/25520180/google-account-login-integration-for-android-xamarin

Alt text Alt text Alt text Alt text Alt text

About

Demo of OAuth2 in Xamarin Forms

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages