示例#1
0
        public static YouTubeHook Authorize(
            string authCode,
            string clientId,
            string secret,
            string redirect)
        {
            YouTubeHook yc = new YouTubeHook();

            yc.clientId   = clientId;
            yc.secret     = secret;
            yc.apiRoot    = "https://www.googleapis.com/youtube/v3";
            yc.redirect   = redirect;
            yc.AccessJson = GetAccessToken(authCode, yc.clientId, yc.secret, yc.redirect);
            yc.loadAccessData();
            yc.loadDisplayName();
            return(yc);
        }
示例#2
0
        public static YouTubeHook ReAuthorize(
            string refreshToken,
            string clientId,
            string secret,
            string redirect = ""
            )
        {
            YouTubeHook yc = new YouTubeHook();

            yc.clientId     = clientId;
            yc.redirect     = redirect;
            yc.secret       = secret;
            yc.RefreshToken = refreshToken;
            yc.apiRoot      = "https://www.googleapis.com/youtube/v3";
            yc.RefreshAuthorization();
            yc.loadDisplayName();
            return(yc);
        }