karishmal / google-api-dotnet-client

Automatically exported from code.google.com/p/google-api-dotnet-client
Apache License 2.0
0 stars 0 forks source link

Error 403 -InSufficient Permission #515

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1.I Have done OAuthentication with oAuth2.0
2.Got Access Token
3.requesting for Watermark unset request

What is the expected output? What do you see instead?

What version of the product are you using?
What is your operating system?
What is your IDE?
What is the .NET framework version?

Please provide any additional information below.
i have done code as per below .please tell me where i am doing mistake.
i have enable youtube Data API V3.0 from api list also

 public async System.Threading.Tasks.Task UnsetWaterMark()
        {
            try
            {

                IAuthorizationCodeFlow flow1 =
               new GoogleAuthorizationCodeFlow(new GoogleAuthorizationCodeFlow.Initializer
               {
                   ClientSecrets = new ClientSecrets
                   {
                       ClientId = "764757459177-8hmhrjfp241p9e3nih02jko0ufevhjk5.apps.googleusercontent.com",
                       ClientSecret = "WMDM2kTtkaLq4W4_JVUKWf6A"
                   },
                   Scopes = new[] { Google.Apis.YouTube.v3.YouTubeService.Scope.Youtube, Google.Apis.YouTube.v3.YouTubeService.Scope.YoutubeUpload, Google.Apis.YouTube.v3.YouTubeService.Scope.Youtubepartner, Google.Apis.YouTube.v3.YouTubeService.Scope.YoutubeReadonly, Google.Apis.YouTube.v3.YouTubeService.Scope.YoutubepartnerChannelAudit },
                   DataStore = new FileDataStore("Youtube.Auth.Store")
               });
                var uri = Request.Url.ToString();
                var code1 = Request["code"];
                if (code1 != null)
                {
                    var token = flow1.ExchangeCodeForTokenAsync("hb.dev002", code1,
                        uri.Substring(0, uri.IndexOf("?")), CancellationToken.None).Result;
                    credential = new UserCredential(flow1, username, token);
                    youtubeService = new Google.Apis.YouTube.v3.YouTubeService(new BaseClientService.Initializer()
                    {
                        ApiKey = "AIzaSyB5Vyisll8O_vCqt_LEKI_OAM-qd_v4cxE",
                        ApplicationName = "Holonis",
                        HttpClientInitializer = credential

                    });
                    // Execute all TasksLists of the user asynchronously.
                    // TaskLists response = await service.Tasklists.List().ExecuteAsync();
                    //  ShowTaskslists(response);
                    WatermarksResource ws = new WatermarksResource(youtubeService);
                    await ws.Unset(channelId.Trim()).ExecuteAsync();
                    // Extract the right state.
                    /*  var oauthState = AuthWebUtility.ExtracRedirectFromState(
                           flow1.DataStore, "hb.dev002", Request["state"]).Result;*/
                      // Response.Redirect(oauthState);
                }

            }
            catch (Exception ex)
            {
                var str = ex.ToString();
                str = str.Replace(Environment.NewLine, Environment.NewLine + "<br/>");
                str = str.Replace("  ", " &nbsp;");
             //   output.Text = string.Format("<font color=\"red\">{0}</font>", str);
            }
        }

 protected async void btnGL_Click(object sender, EventArgs e)
        {
}

Original issue reported on code.google.com by rajpara....@gmail.com on 1 Dec 2014 at 4:47

GoogleCodeExporter commented 9 years ago
I have solved this issue but it gives Error 503 as i have create new issue for 
that..

Original comment by rajpara....@gmail.com on 11 Dec 2014 at 6:32

GoogleCodeExporter commented 9 years ago
User already solved this issue. There is another issue open that still needs to 
be investigated.

Original comment by pele...@google.com on 21 Dec 2014 at 3:00