├── Screenshots ├── Google.png ├── Facebook.png └── Instagram.png ├── SocialMediaAuthentication ├── AssemblyInfo.cs ├── Models │ ├── AuthNetwork.cs │ ├── NetworkAuthData.cs │ ├── FacebookProfile.cs │ └── InstagramUser.cs ├── Services │ ├── IOAuth2Service.cs │ └── IInstagramApi.cs ├── App.xaml ├── Views │ ├── SocialLoginPage.xaml.cs │ ├── HomePage.xaml.cs │ ├── SocialLoginPage.xaml │ └── HomePage.xaml ├── App.xaml.cs ├── SocialMediaAuthentication.csproj └── ViewModels │ └── SocialLoginPageViewModel.cs ├── SocialMediaAuthentication.iOS ├── Resources │ ├── ic_fb.png │ ├── ic_ig.png │ ├── Default.png │ ├── ic_fb@2x.png │ ├── ic_fb@3x.png │ ├── Default@2x.png │ ├── Default-568h@2x.png │ ├── Default-Portrait.png │ ├── Default-Portrait@2x.png │ └── LaunchScreen.storyboard ├── Assets.xcassets │ ├── AppIcon.appiconset │ │ ├── Icon20.png │ │ ├── Icon29.png │ │ ├── Icon40.png │ │ ├── Icon58.png │ │ ├── Icon60.png │ │ ├── Icon76.png │ │ ├── Icon80.png │ │ ├── Icon87.png │ │ ├── Icon1024.png │ │ ├── Icon120.png │ │ ├── Icon152.png │ │ ├── Icon167.png │ │ ├── Icon180.png │ │ └── Contents.json │ └── ic_google.imageset │ │ ├── google_icon.png │ │ ├── google_icon@2x.png │ │ ├── google_icon@3x.png │ │ └── Contents.json ├── Entitlements.plist ├── Main.cs ├── GoogleService-Info.plist ├── Properties │ └── AssemblyInfo.cs ├── AppDelegate.cs ├── Services │ └── OAuth2Service.cs ├── Info.plist └── SocialMediaAuthentication.iOS.csproj ├── SocialMediaAuthentication.Android ├── Resources │ ├── drawable │ │ ├── ic_ig.png │ │ └── ic_google.png │ ├── mipmap-hdpi │ │ ├── icon.png │ │ └── launcher_foreground.png │ ├── mipmap-mdpi │ │ ├── icon.png │ │ └── launcher_foreground.png │ ├── mipmap-xhdpi │ │ ├── icon.png │ │ └── launcher_foreground.png │ ├── drawable-hdpi │ │ └── ic_fb.png │ ├── drawable-ldpi │ │ └── ic_fb.png │ ├── drawable-mdpi │ │ └── ic_fb.png │ ├── mipmap-xxhdpi │ │ ├── icon.png │ │ └── launcher_foreground.png │ ├── mipmap-xxxhdpi │ │ ├── icon.png │ │ └── launcher_foreground.png │ ├── drawable-xhdpi │ │ └── ic_fb.png │ ├── drawable-xxhdpi │ │ └── ic_fb.png │ ├── drawable-xxxhdpi │ │ └── ic_fb.png │ ├── mipmap-anydpi-v26 │ │ ├── icon.xml │ │ └── icon_round.xml │ ├── values │ │ ├── colors.xml │ │ ├── strings.xml │ │ └── styles.xml │ ├── layout │ │ ├── Toolbar.axml │ │ └── Tabbar.axml │ └── AboutResources.txt ├── MainApplication.cs ├── Assets │ └── AboutAssets.txt ├── Properties │ ├── AndroidManifest.xml │ └── AssemblyInfo.cs ├── google-services.json ├── MainActivity.cs ├── Services │ └── OAuth2Service.cs └── SocialMediaAuthentication.Android.csproj ├── README.md ├── LICENSE ├── SocialMediaAuthentication.sln └── .gitignore /Screenshots/Google.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CrossGeeks/SocialMediaAuthenticationSample/HEAD/Screenshots/Google.png -------------------------------------------------------------------------------- /Screenshots/Facebook.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CrossGeeks/SocialMediaAuthenticationSample/HEAD/Screenshots/Facebook.png -------------------------------------------------------------------------------- /Screenshots/Instagram.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CrossGeeks/SocialMediaAuthenticationSample/HEAD/Screenshots/Instagram.png -------------------------------------------------------------------------------- /SocialMediaAuthentication/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using Xamarin.Forms.Xaml; 2 | 3 | [assembly: XamlCompilation(XamlCompilationOptions.Compile)] -------------------------------------------------------------------------------- /SocialMediaAuthentication.iOS/Resources/ic_fb.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CrossGeeks/SocialMediaAuthenticationSample/HEAD/SocialMediaAuthentication.iOS/Resources/ic_fb.png -------------------------------------------------------------------------------- /SocialMediaAuthentication.iOS/Resources/ic_ig.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CrossGeeks/SocialMediaAuthenticationSample/HEAD/SocialMediaAuthentication.iOS/Resources/ic_ig.png -------------------------------------------------------------------------------- /SocialMediaAuthentication.iOS/Resources/Default.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CrossGeeks/SocialMediaAuthenticationSample/HEAD/SocialMediaAuthentication.iOS/Resources/Default.png -------------------------------------------------------------------------------- /SocialMediaAuthentication.iOS/Resources/ic_fb@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CrossGeeks/SocialMediaAuthenticationSample/HEAD/SocialMediaAuthentication.iOS/Resources/ic_fb@2x.png -------------------------------------------------------------------------------- /SocialMediaAuthentication.iOS/Resources/ic_fb@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CrossGeeks/SocialMediaAuthenticationSample/HEAD/SocialMediaAuthentication.iOS/Resources/ic_fb@3x.png -------------------------------------------------------------------------------- /SocialMediaAuthentication.iOS/Resources/Default@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CrossGeeks/SocialMediaAuthenticationSample/HEAD/SocialMediaAuthentication.iOS/Resources/Default@2x.png -------------------------------------------------------------------------------- /SocialMediaAuthentication.iOS/Resources/Default-568h@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CrossGeeks/SocialMediaAuthenticationSample/HEAD/SocialMediaAuthentication.iOS/Resources/Default-568h@2x.png -------------------------------------------------------------------------------- /SocialMediaAuthentication.iOS/Resources/Default-Portrait.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CrossGeeks/SocialMediaAuthenticationSample/HEAD/SocialMediaAuthentication.iOS/Resources/Default-Portrait.png -------------------------------------------------------------------------------- /SocialMediaAuthentication.Android/Resources/drawable/ic_ig.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CrossGeeks/SocialMediaAuthenticationSample/HEAD/SocialMediaAuthentication.Android/Resources/drawable/ic_ig.png -------------------------------------------------------------------------------- /SocialMediaAuthentication.Android/Resources/mipmap-hdpi/icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CrossGeeks/SocialMediaAuthenticationSample/HEAD/SocialMediaAuthentication.Android/Resources/mipmap-hdpi/icon.png -------------------------------------------------------------------------------- /SocialMediaAuthentication.Android/Resources/mipmap-mdpi/icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CrossGeeks/SocialMediaAuthenticationSample/HEAD/SocialMediaAuthentication.Android/Resources/mipmap-mdpi/icon.png -------------------------------------------------------------------------------- /SocialMediaAuthentication.Android/Resources/mipmap-xhdpi/icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CrossGeeks/SocialMediaAuthenticationSample/HEAD/SocialMediaAuthentication.Android/Resources/mipmap-xhdpi/icon.png -------------------------------------------------------------------------------- /SocialMediaAuthentication.iOS/Resources/Default-Portrait@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CrossGeeks/SocialMediaAuthenticationSample/HEAD/SocialMediaAuthentication.iOS/Resources/Default-Portrait@2x.png -------------------------------------------------------------------------------- /SocialMediaAuthentication.Android/Resources/drawable-hdpi/ic_fb.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CrossGeeks/SocialMediaAuthenticationSample/HEAD/SocialMediaAuthentication.Android/Resources/drawable-hdpi/ic_fb.png -------------------------------------------------------------------------------- /SocialMediaAuthentication.Android/Resources/drawable-ldpi/ic_fb.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CrossGeeks/SocialMediaAuthenticationSample/HEAD/SocialMediaAuthentication.Android/Resources/drawable-ldpi/ic_fb.png -------------------------------------------------------------------------------- /SocialMediaAuthentication.Android/Resources/drawable-mdpi/ic_fb.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CrossGeeks/SocialMediaAuthenticationSample/HEAD/SocialMediaAuthentication.Android/Resources/drawable-mdpi/ic_fb.png -------------------------------------------------------------------------------- /SocialMediaAuthentication.Android/Resources/drawable/ic_google.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CrossGeeks/SocialMediaAuthenticationSample/HEAD/SocialMediaAuthentication.Android/Resources/drawable/ic_google.png -------------------------------------------------------------------------------- /SocialMediaAuthentication.Android/Resources/mipmap-xxhdpi/icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CrossGeeks/SocialMediaAuthenticationSample/HEAD/SocialMediaAuthentication.Android/Resources/mipmap-xxhdpi/icon.png -------------------------------------------------------------------------------- /SocialMediaAuthentication.Android/Resources/mipmap-xxxhdpi/icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CrossGeeks/SocialMediaAuthenticationSample/HEAD/SocialMediaAuthentication.Android/Resources/mipmap-xxxhdpi/icon.png -------------------------------------------------------------------------------- /SocialMediaAuthentication.Android/Resources/drawable-xhdpi/ic_fb.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CrossGeeks/SocialMediaAuthenticationSample/HEAD/SocialMediaAuthentication.Android/Resources/drawable-xhdpi/ic_fb.png -------------------------------------------------------------------------------- /SocialMediaAuthentication.Android/Resources/drawable-xxhdpi/ic_fb.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CrossGeeks/SocialMediaAuthenticationSample/HEAD/SocialMediaAuthentication.Android/Resources/drawable-xxhdpi/ic_fb.png -------------------------------------------------------------------------------- /SocialMediaAuthentication.Android/Resources/drawable-xxxhdpi/ic_fb.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CrossGeeks/SocialMediaAuthenticationSample/HEAD/SocialMediaAuthentication.Android/Resources/drawable-xxxhdpi/ic_fb.png -------------------------------------------------------------------------------- /SocialMediaAuthentication.iOS/Assets.xcassets/AppIcon.appiconset/Icon20.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CrossGeeks/SocialMediaAuthenticationSample/HEAD/SocialMediaAuthentication.iOS/Assets.xcassets/AppIcon.appiconset/Icon20.png -------------------------------------------------------------------------------- /SocialMediaAuthentication.iOS/Assets.xcassets/AppIcon.appiconset/Icon29.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CrossGeeks/SocialMediaAuthenticationSample/HEAD/SocialMediaAuthentication.iOS/Assets.xcassets/AppIcon.appiconset/Icon29.png -------------------------------------------------------------------------------- /SocialMediaAuthentication.iOS/Assets.xcassets/AppIcon.appiconset/Icon40.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CrossGeeks/SocialMediaAuthenticationSample/HEAD/SocialMediaAuthentication.iOS/Assets.xcassets/AppIcon.appiconset/Icon40.png -------------------------------------------------------------------------------- /SocialMediaAuthentication.iOS/Assets.xcassets/AppIcon.appiconset/Icon58.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CrossGeeks/SocialMediaAuthenticationSample/HEAD/SocialMediaAuthentication.iOS/Assets.xcassets/AppIcon.appiconset/Icon58.png -------------------------------------------------------------------------------- /SocialMediaAuthentication.iOS/Assets.xcassets/AppIcon.appiconset/Icon60.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CrossGeeks/SocialMediaAuthenticationSample/HEAD/SocialMediaAuthentication.iOS/Assets.xcassets/AppIcon.appiconset/Icon60.png -------------------------------------------------------------------------------- /SocialMediaAuthentication.iOS/Assets.xcassets/AppIcon.appiconset/Icon76.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CrossGeeks/SocialMediaAuthenticationSample/HEAD/SocialMediaAuthentication.iOS/Assets.xcassets/AppIcon.appiconset/Icon76.png -------------------------------------------------------------------------------- /SocialMediaAuthentication.iOS/Assets.xcassets/AppIcon.appiconset/Icon80.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CrossGeeks/SocialMediaAuthenticationSample/HEAD/SocialMediaAuthentication.iOS/Assets.xcassets/AppIcon.appiconset/Icon80.png -------------------------------------------------------------------------------- /SocialMediaAuthentication.iOS/Assets.xcassets/AppIcon.appiconset/Icon87.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CrossGeeks/SocialMediaAuthenticationSample/HEAD/SocialMediaAuthentication.iOS/Assets.xcassets/AppIcon.appiconset/Icon87.png -------------------------------------------------------------------------------- /SocialMediaAuthentication.iOS/Assets.xcassets/AppIcon.appiconset/Icon1024.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CrossGeeks/SocialMediaAuthenticationSample/HEAD/SocialMediaAuthentication.iOS/Assets.xcassets/AppIcon.appiconset/Icon1024.png -------------------------------------------------------------------------------- /SocialMediaAuthentication.iOS/Assets.xcassets/AppIcon.appiconset/Icon120.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CrossGeeks/SocialMediaAuthenticationSample/HEAD/SocialMediaAuthentication.iOS/Assets.xcassets/AppIcon.appiconset/Icon120.png -------------------------------------------------------------------------------- /SocialMediaAuthentication.iOS/Assets.xcassets/AppIcon.appiconset/Icon152.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CrossGeeks/SocialMediaAuthenticationSample/HEAD/SocialMediaAuthentication.iOS/Assets.xcassets/AppIcon.appiconset/Icon152.png -------------------------------------------------------------------------------- /SocialMediaAuthentication.iOS/Assets.xcassets/AppIcon.appiconset/Icon167.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CrossGeeks/SocialMediaAuthenticationSample/HEAD/SocialMediaAuthentication.iOS/Assets.xcassets/AppIcon.appiconset/Icon167.png -------------------------------------------------------------------------------- /SocialMediaAuthentication.iOS/Assets.xcassets/AppIcon.appiconset/Icon180.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CrossGeeks/SocialMediaAuthenticationSample/HEAD/SocialMediaAuthentication.iOS/Assets.xcassets/AppIcon.appiconset/Icon180.png -------------------------------------------------------------------------------- /SocialMediaAuthentication.Android/Resources/mipmap-hdpi/launcher_foreground.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CrossGeeks/SocialMediaAuthenticationSample/HEAD/SocialMediaAuthentication.Android/Resources/mipmap-hdpi/launcher_foreground.png -------------------------------------------------------------------------------- /SocialMediaAuthentication.Android/Resources/mipmap-mdpi/launcher_foreground.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CrossGeeks/SocialMediaAuthenticationSample/HEAD/SocialMediaAuthentication.Android/Resources/mipmap-mdpi/launcher_foreground.png -------------------------------------------------------------------------------- /SocialMediaAuthentication.Android/Resources/mipmap-xhdpi/launcher_foreground.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CrossGeeks/SocialMediaAuthenticationSample/HEAD/SocialMediaAuthentication.Android/Resources/mipmap-xhdpi/launcher_foreground.png -------------------------------------------------------------------------------- /SocialMediaAuthentication.iOS/Assets.xcassets/ic_google.imageset/google_icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CrossGeeks/SocialMediaAuthenticationSample/HEAD/SocialMediaAuthentication.iOS/Assets.xcassets/ic_google.imageset/google_icon.png -------------------------------------------------------------------------------- /SocialMediaAuthentication.Android/Resources/mipmap-xxhdpi/launcher_foreground.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CrossGeeks/SocialMediaAuthenticationSample/HEAD/SocialMediaAuthentication.Android/Resources/mipmap-xxhdpi/launcher_foreground.png -------------------------------------------------------------------------------- /SocialMediaAuthentication.Android/Resources/mipmap-xxxhdpi/launcher_foreground.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CrossGeeks/SocialMediaAuthenticationSample/HEAD/SocialMediaAuthentication.Android/Resources/mipmap-xxxhdpi/launcher_foreground.png -------------------------------------------------------------------------------- /SocialMediaAuthentication.iOS/Assets.xcassets/ic_google.imageset/google_icon@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CrossGeeks/SocialMediaAuthenticationSample/HEAD/SocialMediaAuthentication.iOS/Assets.xcassets/ic_google.imageset/google_icon@2x.png -------------------------------------------------------------------------------- /SocialMediaAuthentication.iOS/Assets.xcassets/ic_google.imageset/google_icon@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CrossGeeks/SocialMediaAuthenticationSample/HEAD/SocialMediaAuthentication.iOS/Assets.xcassets/ic_google.imageset/google_icon@3x.png -------------------------------------------------------------------------------- /SocialMediaAuthentication.Android/Resources/mipmap-anydpi-v26/icon.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /SocialMediaAuthentication.Android/Resources/values/colors.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | #FFFFFF 4 | #3F51B5 5 | #303F9F 6 | #FF4081 7 | -------------------------------------------------------------------------------- /SocialMediaAuthentication.Android/Resources/values/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | SocialMediaAuthentication 4 | 1212486175604889 5 | fb1212486175604889 6 | -------------------------------------------------------------------------------- /SocialMediaAuthentication.Android/Resources/mipmap-anydpi-v26/icon_round.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /SocialMediaAuthentication/Models/AuthNetwork.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | namespace SocialMediaAuthentication.Models 3 | { 4 | public class AuthNetwork 5 | { 6 | public string Name { get; set; } 7 | 8 | public string Icon { get; set; } 9 | 10 | public string Background { get; set; } 11 | 12 | public string Foreground { get; set; } 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /SocialMediaAuthentication.iOS/Entitlements.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | keychain-access-groups 6 | 7 | $(AppIdentifierPrefix)com.crossgeeks.SocialMediaAuthentication 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /SocialMediaAuthentication/Services/IOAuth2Service.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | namespace SocialMediaAuthentication.Services 3 | { 4 | public interface IOAuth2Service 5 | { 6 | event EventHandler OnSuccess; 7 | event EventHandler OnError; 8 | event EventHandler OnCancel; 9 | 10 | void Authenticate(string clientId, string scope, Uri authorizeUrl, Uri redirectUrl); 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /SocialMediaAuthentication.Android/Resources/layout/Toolbar.axml: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /SocialMediaAuthentication/Services/IInstagramApi.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Net.Http; 3 | using System.Threading.Tasks; 4 | using Refit; 5 | 6 | namespace SocialMediaAuthentication.Services 7 | { 8 | [Headers("Content-Type: application/json")] 9 | public interface IInstagramApi 10 | { 11 | [Get("/v1/users/self/?access_token={accessToken}")] 12 | Task GetUser(string accessToken); 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /SocialMediaAuthentication/Models/NetworkAuthData.cs: -------------------------------------------------------------------------------- 1 | using Newtonsoft.Json; 2 | 3 | namespace SocialMediaAuthentication.Models 4 | { 5 | public class NetworkAuthData 6 | { 7 | public string Id { get; set; } 8 | 9 | public string Name { get; set; } 10 | 11 | public string Logo { get; set; } 12 | 13 | public string Picture { get; set; } 14 | 15 | public string Background { get; set; } 16 | 17 | public string Foreground { get; set; } 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /SocialMediaAuthentication/App.xaml: -------------------------------------------------------------------------------- 1 | 2 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /SocialMediaAuthentication/Views/SocialLoginPage.xaml.cs: -------------------------------------------------------------------------------- 1 | using SocialMediaAuthentication.Services; 2 | using SocialMediaAuthentication.ViewModels; 3 | using Xamarin.Forms; 4 | 5 | namespace SocialMediaAuthentication.Views 6 | { 7 | public partial class SocialLoginPage : ContentPage 8 | { 9 | public SocialLoginPage(IOAuth2Service oAuth2Service) 10 | { 11 | InitializeComponent(); 12 | this.BindingContext = new SocialLoginPageViewModel(oAuth2Service); 13 | } 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /SocialMediaAuthentication.Android/Resources/layout/Tabbar.axml: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /SocialMediaAuthentication.iOS/Assets.xcassets/ic_google.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images": [ 3 | { 4 | "filename": "google_icon@3x.png", 5 | "scale": "3x", 6 | "idiom": "universal" 7 | }, 8 | { 9 | "filename": "google_icon@2x.png", 10 | "scale": "2x", 11 | "idiom": "universal" 12 | }, 13 | { 14 | "filename": "google_icon.png", 15 | "scale": "1x", 16 | "idiom": "universal" 17 | } 18 | ], 19 | "info": { 20 | "version": 1, 21 | "author": "xcode" 22 | } 23 | } -------------------------------------------------------------------------------- /SocialMediaAuthentication.iOS/Main.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | 5 | using Foundation; 6 | using UIKit; 7 | 8 | namespace SocialMediaAuthentication.iOS 9 | { 10 | public class Application 11 | { 12 | // This is the main entry point of the application. 13 | static void Main(string[] args) 14 | { 15 | // if you want to use a different Application Delegate class from "AppDelegate" 16 | // you can specify it here. 17 | UIApplication.Main(args, null, "AppDelegate"); 18 | } 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | 2 | # Social Media Authentication 3 | 4 | ## Facebook 5 |

6 | 7 |

8 | 9 | Blog post: [Facebook](http://www.xamboy.com/2019/07/23/social-media-authentication-facebook-login-in-xamarin-forms/) 10 | 11 | 12 | ## Instagram 13 |

14 | 15 |

16 | 17 | Blog post: [Instagram](http://www.xamboy.com/2019/08/02/social-media-authentication-instagram-login-in-xamarin-forms/) 18 | 19 | ## Google 20 |

21 | 22 |

23 | -------------------------------------------------------------------------------- /SocialMediaAuthentication.Android/MainApplication.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using Android.App; 3 | using Android.Runtime; 4 | using Plugin.CurrentActivity; 5 | 6 | namespace SocialMediaAuthentication.Droid 7 | { 8 | #if DEBUG 9 | [Application(Debuggable = true)] 10 | #else 11 | [Application(Debuggable = false)] 12 | #endif 13 | public class MainApplication : Application 14 | { 15 | public MainApplication(IntPtr handle, JniHandleOwnership transer) 16 | : base(handle, transer) 17 | { 18 | } 19 | 20 | public override void OnCreate() 21 | { 22 | base.OnCreate(); 23 | CrossCurrentActivity.Current.Init(this); 24 | } 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /SocialMediaAuthentication.Android/Assets/AboutAssets.txt: -------------------------------------------------------------------------------- 1 | Any raw assets you want to be deployed with your application can be placed in 2 | this directory (and child directories) and given a Build Action of "AndroidAsset". 3 | 4 | These files will be deployed with you package and will be accessible using Android's 5 | AssetManager, like this: 6 | 7 | public class ReadAsset : Activity 8 | { 9 | protected override void OnCreate (Bundle bundle) 10 | { 11 | base.OnCreate (bundle); 12 | 13 | InputStream input = Assets.Open ("my_asset.txt"); 14 | } 15 | } 16 | 17 | Additionally, some Android functions will automatically load asset files: 18 | 19 | Typeface tf = Typeface.CreateFromAsset (Context.Assets, "fonts/samplefont.ttf"); 20 | -------------------------------------------------------------------------------- /SocialMediaAuthentication/Models/FacebookProfile.cs: -------------------------------------------------------------------------------- 1 | using Newtonsoft.Json; 2 | 3 | namespace SocialMediaAuthentication.Models 4 | { 5 | public class Data 6 | { 7 | [JsonProperty("is_silhouette")] 8 | public bool IsSilhouette { get; set; } 9 | public int Height { get; set; } 10 | public string Url { get; set; } 11 | public int Width { get; set; } 12 | } 13 | 14 | public class Picture 15 | { 16 | public Data Data { get; set; } 17 | } 18 | 19 | public class FacebookProfile 20 | { 21 | public string Email { get; set; } 22 | public string Id { get; set; } 23 | public Picture Picture { get; set; } 24 | 25 | [JsonProperty("last_name")] 26 | public string LastName { get; set; } 27 | [JsonProperty("first_name")] 28 | public string FirstName { get; set; } 29 | } 30 | 31 | } -------------------------------------------------------------------------------- /SocialMediaAuthentication/App.xaml.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using SocialMediaAuthentication.Services; 3 | using SocialMediaAuthentication.Views; 4 | using Xamarin.Forms; 5 | using Xamarin.Forms.Xaml; 6 | 7 | namespace SocialMediaAuthentication 8 | { 9 | public partial class App : Application 10 | { 11 | 12 | public App(IOAuth2Service oAuth2Service) 13 | { 14 | InitializeComponent(); 15 | 16 | MainPage = new NavigationPage(new SocialLoginPage(oAuth2Service)); 17 | } 18 | 19 | protected override void OnStart() 20 | { 21 | // Handle when your app starts 22 | } 23 | 24 | protected override void OnSleep() 25 | { 26 | // Handle when your app sleeps 27 | } 28 | 29 | protected override void OnResume() 30 | { 31 | // Handle when your app resumes 32 | } 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2019 CrossGeeks 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /SocialMediaAuthentication/Views/HomePage.xaml.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using Plugin.FacebookClient; 4 | using Plugin.GoogleClient; 5 | using SocialMediaAuthentication.Models; 6 | using Xamarin.Forms; 7 | 8 | namespace SocialMediaAuthentication.Views 9 | { 10 | public partial class HomePage : ContentPage 11 | { 12 | public HomePage(NetworkAuthData networkAuthData) 13 | { 14 | BindingContext = networkAuthData; 15 | InitializeComponent(); 16 | } 17 | 18 | async void OnLogout(object sender, System.EventArgs e) 19 | { 20 | if(BindingContext is NetworkAuthData data) 21 | { 22 | switch(data.Name) 23 | { 24 | case "Facebook": 25 | CrossFacebookClient.Current.Logout(); 26 | break; 27 | case "Google": 28 | CrossGoogleClient.Current.Logout(); 29 | break; 30 | } 31 | 32 | await Navigation.PopModalAsync(); 33 | } 34 | } 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /SocialMediaAuthentication/SocialMediaAuthentication.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | netstandard2.0 5 | true 6 | 7 | 8 | 9 | pdbonly 10 | true 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | -------------------------------------------------------------------------------- /SocialMediaAuthentication/Models/InstagramUser.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using Newtonsoft.Json; 3 | 4 | namespace SocialMediaAuthentication.Models 5 | { 6 | public class InstagramCounts 7 | { 8 | public int Media { get; set; } 9 | public int Follows { get; set; } 10 | [JsonProperty("followed_by")] 11 | public int FollowedBy { get; set; } 12 | } 13 | 14 | public class InstagramData 15 | { 16 | public string Id { get; set; } 17 | public string Username { get; set; } 18 | [JsonProperty("profile_picture")] 19 | public string ProfilePicture { get; set; } 20 | [JsonProperty("full_name")] 21 | public string FullName { get; set; } 22 | public string Bio { get; set; } 23 | public string Website { get; set; } 24 | [JsonProperty("is_business")] 25 | public bool IsBusiness { get; set; } 26 | public InstagramCounts Counts { get; set; } 27 | } 28 | 29 | public class InstagramMeta 30 | { 31 | public int Code { get; set; } 32 | } 33 | 34 | public class InstagramUser 35 | { 36 | public InstagramData Data { get; set; } 37 | public InstagramMeta Meta { get; set; } 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /SocialMediaAuthentication.Android/Properties/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | -------------------------------------------------------------------------------- /SocialMediaAuthentication.iOS/GoogleService-Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CLIENT_ID 6 | 60015114581-8t3d8n4r2s38fvltdqrnf8ip7thqcntu.apps.googleusercontent.com 7 | REVERSED_CLIENT_ID 8 | com.googleusercontent.apps.60015114581-8t3d8n4r2s38fvltdqrnf8ip7thqcntu 9 | API_KEY 10 | AIzaSyAjgaL2JOzTod5IL_XXUWSL3DA16Qbz1lA 11 | GCM_SENDER_ID 12 | 60015114581 13 | PLIST_VERSION 14 | 1 15 | BUNDLE_ID 16 | com.crossgeeks.SocialMediaAuthentication 17 | PROJECT_ID 18 | social-media-authenticat-1ba2a 19 | STORAGE_BUCKET 20 | social-media-authenticat-1ba2a.appspot.com 21 | IS_ADS_ENABLED 22 | 23 | IS_ANALYTICS_ENABLED 24 | 25 | IS_APPINVITE_ENABLED 26 | 27 | IS_GCM_ENABLED 28 | 29 | IS_SIGNIN_ENABLED 30 | 31 | GOOGLE_APP_ID 32 | 1:60015114581:ios:69ad50bf2733bd97af17dc 33 | DATABASE_URL 34 | https://social-media-authenticat-1ba2a.firebaseio.com 35 | 36 | -------------------------------------------------------------------------------- /SocialMediaAuthentication.Android/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.CompilerServices; 3 | using System.Runtime.InteropServices; 4 | using Android.App; 5 | 6 | // General Information about an assembly is controlled through the following 7 | // set of attributes. Change these attribute values to modify the information 8 | // associated with an assembly. 9 | [assembly: AssemblyTitle("SocialMediaAuthentication.Android")] 10 | [assembly: AssemblyDescription("")] 11 | [assembly: AssemblyConfiguration("")] 12 | [assembly: AssemblyCompany("")] 13 | [assembly: AssemblyProduct("SocialMediaAuthentication.Android")] 14 | [assembly: AssemblyCopyright("Copyright © 2014")] 15 | [assembly: AssemblyTrademark("")] 16 | [assembly: AssemblyCulture("")] 17 | [assembly: ComVisible(false)] 18 | 19 | // Version information for an assembly consists of the following four values: 20 | // 21 | // Major Version 22 | // Minor Version 23 | // Build Number 24 | // Revision 25 | // 26 | // You can specify all the values or you can default the Build and Revision Numbers 27 | // by using the '*' as shown below: 28 | // [assembly: AssemblyVersion("1.0.*")] 29 | [assembly: AssemblyVersion("1.0.0.0")] 30 | [assembly: AssemblyFileVersion("1.0.0.0")] 31 | 32 | // Add some common permissions, these can be removed if not needed 33 | [assembly: UsesPermission(Android.Manifest.Permission.Internet)] 34 | [assembly: UsesPermission(Android.Manifest.Permission.WriteExternalStorage)] 35 | -------------------------------------------------------------------------------- /SocialMediaAuthentication/Views/SocialLoginPage.xaml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | 11 | 12 | 13 |