public static BaseOAuth2Services GetServices(OAuthServices services)
        {
            switch (services)
            {
            case OAuthServices.facebook:
                if (OAuth2Setting.UseFacebook)
                {
                    return(new FaceBookServices());
                }
                else
                {
                    Debug.LogError("You have to check 'use facebook' checkbox. It's in CloudBread-CBAuthentication, Facebook Tab");
                    return(null);
                }

            case OAuthServices.google:
                if (OAuth2Setting.UseGooglePlay)
                {
                    return(new GooglePlayServices());
                }
                else
                {
                    Debug.LogError("You have to check 'use google play' checkbox. It's in CloudBread-CBAuthentication, Google Tab");
                    return(null);
                }

            default:
                return(null);
            }
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                if (Global.PendingOAuthAuthorization == null)
                {
                    //no pending authorization
                }
                else
                {
                    ITokenContainingMessage pendingToken = Global.PendingOAuthAuthorization;
                    var token = OAuthServices.GetToken(pendingToken.Token);        // Global.TokenManager.AuthTokens.Single(t => t.Token == pendingToken.Token);
                    this.desiredAccessLabel.Text = token.Scope;
                    this.consumerLabel.Text      = token.AuthConsumer.ConsumerKey; // Global.TokenManager.GetConsumerForToken(token.Token).Key;

                    // Generate an unpredictable secret that goes to the user agent and must come back
                    // with authorization to guarantee the user interacted with this page rather than
                    // being scripted by an evil Consumer.
                    byte[] randomData = new byte[8];
                    CryptoRandomDataGenerator.GetBytes(randomData);
                    this.AuthorizationSecret = Convert.ToBase64String(randomData);
                    this.OAuthAuthorizationSecToken.Value = this.AuthorizationSecret;

                    this.OAuth10ConsumerWarning.Visible = Global.PendingOAuthAuthorization.IsUnsafeRequest;
                }
            }
        }