예제 #1
0
 /// <summary>
 /// Get an Auth URL. This should be step 1 in a new authentication process.
 /// </summary>
 /// <param name="cid">Your Client/Application ID</param>
 /// <param name="scopes">List of scopes (permissions), e.g. {"public"}</param>
 /// <param name="redirect">Redirect URL (same as what you put in your app description)</param>
 /// <param name="apiRoot">API Endpoint (optional)</param>
 /// <returns></returns>
 public static string GetAuthURL(
     string cid,
     List <string> scopes = null,
     string redirect      = "",
     string apiRoot       = "https://api.vimeo.com")
 {
     return(VimeoAuth.GetAuthURL(cid, scopes, redirect, apiRoot));
 }
예제 #2
0
        /// <summary>
        /// After the user opens the URL generated with Auth.GetAuthURL
        /// you pass the "code" (access code) with your API keys to this
        /// method. This logs you in and you can start accessing vimeo.
        /// YOU DON'T NEED TO CALL GetAccessToken AS IT WILL BE CALLED HERE.
        ///
        /// If getting access token fails, it will throw different HTTP errors,
        /// one of which is 404. Surround with try/catch to handle it.
        /// </summary>
        /// <param name="authCode">Auth code that you get after opening the URL from Auth.GetAuthURL</param>
        /// <param name="cid">Your Client/Application ID</param>
        /// <param name="secret">Your Client/Application Secret</param>
        /// <param name="redirect">The Redirect URL That You Specified In API Page</param>
        /// <param name="apiRoot">API Endpoint (optional)</param>
        public static VimeoClient Authorize(
            string authCode,
            string cid,
            string secret,
            string redirect,
            string apiRoot = "https://api.vimeo.com")
        {
            VimeoClient vc = new VimeoClient();

            vc.clientId   = cid;
            vc.secret     = secret;
            vc.apiRoot    = apiRoot;
            vc.AccessJson = VimeoAuth.GetAccessToken(authCode, cid, secret, redirect, apiRoot);
            vc.loadAccessData();
            return(vc);
        }