TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Johan
NA
9
1.9k
Insufficient authentication scopes in relation to Syntax “Up
Mar 21 2018 4:59 AM
Goal:
Use Google Sheet API by using the syntax code "spreadsheets.values.update" in order to update the current cell.
Problem:
I have used the code that is provded by Google Sheet's tutorial (https://developers.google.com/sheets/api/reference/rest/v4/spreadsheets.values/update) and it doesn't work.
I retrieve a error message saying:
"An unhandled exception of type 'Google.GoogleApiException' occurred in mscorlib.dll Additional information: Google.Apis.Requests.RequestError Request had insufficient authentication scopes. [403] Errors [ Message[Request had insufficient authentication scopes.] Location[ - ] Reason[forbidden] Domain[global] ]"
Info:
*I was enable to use Oath 2.0 authenfication in relation to syntax code "spreadsheets.values.get" (https://developers.google.com/sheets/api/reference/rest/v4/spreadsheets.values/get) and it works perfectly.
*The same code of Oath 2.0 that is used in "spreadsheets.values.get" works well.
Thank you!
private
void
btn_test6_Click(
object
sender, RoutedEventArgs e)
{
UserCredential credential;
using
(var stream =
new
FileStream(
"client_secret.json"
, FileMode.Open, FileAccess.Read))
{
string
credPath = System.Environment.GetFolderPath(System.Environment.SpecialFolder.Personal);
credential = GoogleWebAuthorizationBroker.AuthorizeAsync(
GoogleClientSecrets.Load(stream).Secrets,
Scopes,
"user"
,
CancellationToken.None,
new
FileDataStore(credPath,
true
)).Result;
Console.WriteLine(
"Credential file saved to: "
+ credPath);
}
SheetsService sheetsService =
new
SheetsService(
new
BaseClientService.Initializer
{
HttpClientInitializer = credential,
ApplicationName =
"Google-SheetsSample/0.1"
,
});
// The ID of the spreadsheet to update.
string
spreadsheetId =
""
;
// TODO: Update placeholder value.
// The A1 notation of the values to update.
string
range =
"datadata!A1:A6"
;
// TODO: Update placeholder value.
// How the input data should be interpreted.
SpreadsheetsResource.ValuesResource.UpdateRequest.ValueInputOptionEnum valueInputOption = (SpreadsheetsResource.ValuesResource.UpdateRequest.ValueInputOptionEnum)0;
// TODO: Update placeholder value.
IList<
object
> my =
new
List<
object
>();
my.Add(
"a"
);
my.Add(
"a"
);
my.Add(
"a"
);
my.Add(
"a"
);
my.Add(
"a"
);
my.Add(
"a"
);
IList
object
>> my2 =
new
List
object
>>();
my2.Add(my);
// TODO: Assign values to desired properties of `requestBody`. All existing
// properties will be replaced:
Google.Apis.Sheets.v4.Data.ValueRange requestBody =
new
Google.Apis.Sheets.v4.Data.ValueRange();
requestBody.Values = my2;
SpreadsheetsResource.ValuesResource.UpdateRequest request = sheetsService.Spreadsheets.Values.Update(requestBody, spreadsheetId, range);
request.ValueInputOption = valueInputOption;
// To execute asynchronously in an async method, replace `request.Execute()` as shown:
Google.Apis.Sheets.v4.Data.UpdateValuesResponse response = request.Execute();
// Data.UpdateValuesResponse response = await request.ExecuteAsync();
// TODO: Change code below to process the `response` object:
Console.WriteLine(JsonConvert.SerializeObject(response));
}
Reply
Answers (
0
)
How to get status of the user (online,offline,away)
SqlException was unhandled ,Invalid object name 'Mobil'.