Hallo,

das interessiert mich auch sehr, es wäre nett von Dir wenn Du die Lösung
posten würdest.

Bist du sicher das Du alle Einstellungen richtig hast

https://console.developers.google.com/apis/credentials?project=region1-0&authuser=0

LG

Olaf

2016-06-23 12:35 GMT+02:00 Charles Serra <[email protected]>:

> Hello,
>
> I'm working with dotnet C#, Sheets v4.
> I'm the owner of a sheets in Drive, which is shared with some people who
> are internal and external of the company.
>
> We are using service account also with adwords API.
> For sheets, we added scope "SheetsService.Scope.SpreadsheetsReadonly" on
> the Google Console Admin
>
> When we are trying to read the sheets with the API, even with my account
> (whereas I'm the owner), we got an exception "*Error:"unauthorized_client",
> Description:"Unauthorized client or scope in request.", Uri:""*
>
> It's working with a public sheets on a personnal drive account, with the
> sharing policy "read access to anyone with the link"
>
>
>    1. What am I doing wrong?
>    2. Can you confirm it's possible to impersonate a user using the User
>    property of the ServiceAccountCredential.Initializer object?
>
>
>
> The source code:
>
>
> try
>
> {
>
> AdWordsAuthenticationConfig auth = Service.Auth;
>
>
>
> X509Certificate2 certificate = new X509Certificate2(auth.CertificatePath,
> "notasecret", X509KeyStorageFlags.Exportable);
>
>
>
> ServiceAccountCredential cred = new ServiceAccountCredential(
>
> new ServiceAccountCredential.Initializer(auth.ServiceAccountEmail)
>
> {
>
> Scopes = new string[] { SheetsService.Scope.SpreadsheetsReadonly },
>
> User = "[email protected]",
>
> }.FromCertificate(certificate)
>
> );
>
>
>
> SheetsService service = new SheetsService(new BaseClientService.
> Initializer
>
> {
>
> HttpClientInitializer = cred
>
> });
>
>
>
> SpreadsheetsResource.ValuesResource.GetRequest request =
> service.Spreadsheets.Values.Get(spreadsheetId, range);
>
>
>
> ValueRange response = request.Execute();
>
>
>
> return response.Values;
>
> }
>
> catch (Exception ex)
>
> {
>
> ...
>
> }
>
>
> Kind regards,
>
> Charles.
>
>
> --
> You received this message because you are subscribed to the Google Groups
> "Google Spreadsheets API" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> For more options, visit https://groups.google.com/d/optout.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Google Spreadsheets API" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to