コード例 #1
0
ファイル: API.cs プロジェクト: ffleischer/GoogleMusic.NET
        public virtual Tuple<string, string> MasterLogin(string email, string password, string androidId)
        {
            GPSOAuthClient gpsOAuthClient = new GPSOAuthClient();
            gpsOAuthClient.Proxy = Proxy;

            try
            {
                gpsOAuthClient.MasterLogin(email, password, androidId);
            }
            catch (WebException error)
            {
                ThrowError("Authentication failed!", error);
            }

            return gpsOAuthClient.MasterToken;
        }
コード例 #2
0
ファイル: API.cs プロジェクト: ffleischer/GoogleMusic.NET
        protected bool PerformOAuth(string login, string mastertoken)
        {
            const string client_sig = "38918a453d07199354f8b19af05ec6562ced5788";
            Dictionary<string, string> oauth;

            _credentials = new Credentials();

            GPSOAuthClient gpsoauth = new GPSOAuthClient(login, mastertoken);
            gpsoauth.Proxy = Proxy;

            try
            {
                oauth = gpsoauth.PerformOAuth("sj", "com.google.android.music", client_sig);
            }
            catch(WebException error)
            {
                ThrowError("Authentication failed!", error);
                return false;
            }

            if (oauth.ContainsKey("SID") && oauth.ContainsKey("LSID") && oauth.ContainsKey("Auth"))
            {
                _credentials.SID = oauth["SID"];
                _credentials.LSID = oauth["LSID"];
                _credentials.Auth = oauth["Auth"];
            }
            else
            {
                ThrowError("Login failed!");
                return false;
            }

            return true;
        }