Error: Unauthorized client or scope in request 5


Please Share

I have had a few emails recently about a strange error from the Google .net Client library. Last night was the first time I saw it on one of my projects personally. I am not sure what is causing the problem exactly. But I can tell you how to fix it.

Error:”unauthorized_client”, Description:”Unauthorized client or scope in request.”, Uri:””

It seams to happen when there is a problem with one or more of the .dlls imported with the NuGet packages. All you have to do is re-install the NuGet package. You don’t even need to uninstall it first. Just run the NuGet command again. It should fix your problem.

If this doesn’t fix your issue please comment below so that we can find more ways of dealing with it.

Please Share


Linda Lawton

About Linda Lawton

My name is Linda Lawton I have more than 20 years experience working as a developer and a database expert. I have been working with several of the Google APIs, since 2012. I helping others in the On-Line community to develop with the Google APIs, by creating my own blog www.daimto.com. This and my presence on a number of On-Line developer forums lead me to be noticed by the Google Analytics API development team. I was nominated for and recently became one of the first Google Developer Experts for Google Analytics.


Leave a comment

Your email address will not be published. Required fields are marked *

5 thoughts on “Error: Unauthorized client or scope in request

  • Patrik Chynoransky

    Hello,
    I get the same message (but as an exception, not an error) when I try to call the “refreshTokenWithAssertion()” method while authenticating to use Directory API.
    I don’t recall installing the NuGet package. Does this issue apply to Ubuntu OS, too?
    Thanks.

  • Sergio Barbosa

    Hello, very nice blog … congratulations!

    Have any examples of how to use the Google Drive Web Application?

    See the problem below:

    Used the framework 4.0 (VS2013) and Google.Api 1.9 (NuGet). Already released full access and the error persists. I’m trying to set up to authenticate to web application.

    Stack Trace:

    [Win32Exception (0x80004005): An error occurred in sending the command to the application]
    Microsoft.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) +82
    Microsoft.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccess(Task task) +71
    Google.Apis.Auth.OAuth2.d__1.MoveNext() +262

    [AggregateException: One or more errors occurred.]
    System.Threading.Tasks.Task.ThrowIfExceptional(Boolean includeTaskCanceledExceptions) +3548265
    System.Threading.Tasks.Task`1.GetResultCore(Boolean waitCompletionNotification) +73
    System.Threading.Tasks.Task`1.get_Result() +10486829
    DriveSample.Page_Load(Object sender, EventArgs e) +194
    System.Web.Util.CalliEventHandlerDelegateProxy.Callback(Object sender, EventArgs e) +51
    System.Web.UI.Control.OnLoad(EventArgs e) +92
    System.Web.UI.Control.LoadRecursive() +54
    System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +772

  • Juan Pablo

    I re-install but not solutionate
    what can i do ?

    var certificate = new X509Certificate2(“devcoemmi.p12”, “notasecret”, X509KeyStorageFlags.Exportable);
    var serviceAccountEmail = “815410429507-eq884s5pgii5mom1c2t700h715r0c8sd@developer.gserviceaccount.com”;
    var userAccountEmail = “albertosl@tag-id.com.co”;
    //userAccountEmail = “User”;
    ServiceAccountCredential credential = new ServiceAccountCredential(
    new ServiceAccountCredential.Initializer(serviceAccountEmail)
    {
    Scopes = new[] { DriveService.Scope.Drive, DriveService.Scope.DriveAppdata, DriveService.Scope.DriveAppsReadonly, DriveService.Scope.DriveFile, DriveService.Scope.DriveMetadata, DriveService.Scope.DriveMetadataReadonly, DriveService.Scope.DriveReadonly, DriveService.Scope.DriveScripts }
    ,
    User = userAccountEmail

    }.FromCertificate(certificate));

    // Create the service.
    var service = new DriveService(new BaseClientService.Initializer()
    {
    HttpClientInitializer = credential,
    ApplicationName = “devcoemmi”,
    });

    var listReq = service.Files.List();
    FileList files = listReq.Execute();
    tbFileCount.Text = files.Items.Count().ToString();