public LoginServicePickerViewModel()
        {

            this.googleClient = this.LoadSafelyFromLocalSettings(OAuth2ServiceConstants.GoogleOAuth2Service);
            this.facebookClient = this.LoadSafelyFromLocalSettings(OAuth2ServiceConstants.FacebookOAuth2Service);
            this.liveClient = this.LoadSafelyFromLocalSettings(OAuth2ServiceConstants.LiveOAuth2Service);

            this.GoogleLoginCommand = new RelayCommand(this.GoogleLogin);
            this.FacebookLoginCommand = new RelayCommand(this.FacebookLogin);
            this.LiveLoginCommand = new RelayCommand(this.LiveLogin);
        }
        private OAuth2Client LoadSafelyFromLocalSettings(OAuth2ServiceConstants serviceConstant)
        {
            var localSettings = ApplicationData.Current.LocalSettings;
            var oauthClient = new OAuth2Client();
            if (localSettings.Values.ContainsKey(serviceConstant.ClientId))
            {
                oauthClient.Id = localSettings.Values[serviceConstant.ClientId].ToString();
            }

            if (localSettings.Values.ContainsKey(serviceConstant.ClientSecret))
            {
                oauthClient.Secret = localSettings.Values[serviceConstant.ClientSecret].ToString();
            }

            return oauthClient;
        }
Esempio n. 3
0
 protected OAuth2ServiceBase(IOAuth2Initializer oAuth2Initializer, OAuth2Client oAuth2Client)
 {
     this.oAuth2Initializer = oAuth2Initializer;
     this.ClientId          = oAuth2Client.Id;
     this.ClientSecret      = oAuth2Client.Secret;
 }
Esempio n. 4
0
 public FacebookOAuth2Service(IOAuth2Initializer oAuth2Initializer, OAuth2Client oAuth2Client)
     : base(oAuth2Initializer, oAuth2Client)
 {
 }
Esempio n. 5
0
 public GoogleOAuth2Service(IOAuth2Initializer oAuth2Initializer, OAuth2Client oAuth2Client)
     : base(oAuth2Initializer, oAuth2Client)
 {
 }