Using gspread API and oauth2, permissions error - oauth-2.0

Using this code:
import gspread
from oauth2client.service_account import ServiceAccountCredentials
scope = ['https://www.googleapis.com/auth/spreadsheets',
'https://spreadsheets.google.com/feeds']
credentials = ServiceAccountCredentials.from_json_keyfile_name('Consumer
Outr.json', scope)
gc = gspread.authorize(credentials)
nonStartFreeTrial = gc.open("Consumer Outreach")[0]
I need to use the service credentials API from google instead of the regular API keys, and I keep getting:
APIError: {
"error": {
"errors": [
{
"domain": "global",
"reason": "insufficientPermissions",
"message": "Insufficient Permission"
}
],
"code": 403,
"message": "Insufficient Permission"
}
}
I'm writing this code in ipynb, and ideally will be able to access the spreadsheet from a live cell. I've read that this can be fixed using an API key, but gspread documentation suggests Service Account Credentials are the best method. Genuinely have no idea what to fix (new to google APIs!).

Related

OAuth 2.0 Playground - Examples of Headers for sending email with Gmail API v1

I have been searching all day for the format I need to use to add Headers to the OAuth 2.0 Playground to be able to send an email within the OAuth 2.0 Playground.
I have tried From, Subject, Sender, To but I still get the following error.
{
"error": {
"status": "INVALID_ARGUMENT",
"message": "Recipient address required",
"code": 400,
"errors": [
{
"reason": "invalidArgument",
"message": "Recipient address required",
"domain": "global"
}
]
}
}
I would love to see an example of what you have done to get this to work.
Thx
Marty

Google Cloud Translation API got error "403 User Rate Limit Exceeded"

I'm using Google Cloud Translation Service for my bussiness
When I use URL "https://translation.googleapis.com/language/translate/v2" to translate my text. The result is :
{
"error": {
"code": 403,
"message": "User Rate Limit Exceeded",
"errors": [
{
"message": "User Rate Limit Exceeded",
"domain": "usageLimits",
"reason": "userRateLimitExceeded"
}
]
}
}
I already used payment version, and config all in Google Cloud Console but useless.
Who can help me...
POSTMAN

I can't get this Google Sheets API Get request to work

I am trying to have a game to request data from the Google Sheets API, and I can't get the API Key to function properly. I can visit my API Link in the browser, and it tells me it is getting HTTP 400 (Bad Request) and Google additionally says it's a bad API Key, despite having JUST generated it. For reference my link looks like this: "https://sheets.googleapis.com/v4/spreadsheets/[SHEET_ID]?key=[API_KEY]/values", and the browser views this when using it:
"error": {
"code": 400,
"message": "API key not valid. Please pass a valid API key.",
"status": "INVALID_ARGUMENT",
"details": [
{
"#type": "type.googleapis.com/google.rpc.ErrorInfo",
"reason": "API_KEY_INVALID",
"domain": "googleapis.com",
"metadata": {
"service": "sheets.googleapis.com"
}
}
]
}
}
I have absolutely no idea what is going wrong, I know the API key and Sheet ID are right (Directly copied each from their respective source).

Accessing Intune Graph API Forbidden Error

I am O Auth 2 authorization code flow to Authenticate to Azure and Invoke Graph APIs for Intune (by delegated app that was created in Intune for access to API).
Following permissions has been provided at the APP registered in Azure under my organization tenant.
https://graph.microsoft.com/DeviceManagementApps.Read.All https://graph.microsoft.com/DeviceManagementConfiguration.Read.All https://graph.microsoft.com/DeviceManagementManagedDevices.Read.All https://graph.microsoft.com/User.Read
API under scope:
https://graph.microsoft.com/v1.0/deviceManagement/detectedApps
https://graph.microsoft.com/v1.0/deviceAppManagement/mobileApps```
I am getting the following error both at Mobile APP level and Postman. Could you please help me to identify the issue?
{
"error": {
"code": "UnknownError",
"message": {
"ErrorCode": "Forbidden",
"Message": {
"_version ": 3,
"Message": "An error has occurred - Operation ID (for customer support): 00000000-0000-0000-0000-000000000000 - Activity ID: c85eb7ab-687d-4780-bd88-94a3b52e7df7 - Url: https://fef.msub02.manage.microsoft.com/DeviceConfiguration_2008/StatelessDeviceConfigurationFEService/deviceManagement/deviceConfigurations?api-version=2020-02-21",
"CustomApiErrorPhrase": "",
"RetryAfter": null,
"ErrorSourceService": "",
"HttpHeaders": {
"WWW-Authenticate": "Bearer realm=urn:intune:service,bb7003b9-cb7f-44b2-b534-54f84f2f0d63,f0f3c450-59bf-4f0d-b1b2-0ef84ddfe3c7"
}
},
"Target": null,
"Details": null,
"InnerError": null,
"InstanceAnnotations": []
},
"innerError": {
"date": "2020-09-02T21:09:14"
"request-id": "c85eb7ab-687d-4780-bd88-94a3b52e7df7",
}
}```
You can try using the Global Administrator role or a Global reader role to read the intune data as there is a necessity of having these roles. After giving any of these roles, try the below calls with their respective permissions.
https://graph.microsoft.com/v1.0/deviceManagement/detectedApps
https://graph.microsoft.com/v1.0/deviceAppManagement/mobileApps

YouTube API V3 Comment Threads doesn't work with access Token

I am trying to call the following url with my access token which is for getting comments from a video but it doesn't seem to work and gives me a Insufficient Permissions Error.
Here's the URL I try to call-
https://www.googleapis.com/youtube/v3/commentThreads?part=snippet&maxResults=1&videoId=tdUX3ypDVwI&access_token={myAccessToken}
but it sends me the following error:
{
"error": {
"errors": [
{
"domain": "global",
"reason": "insufficientPermissions",
"message": "Insufficient Permission"
}
],
"code": 403,
"message": "Insufficient Permission"
}
}
Apparently, It doesn't make sense to me? Please help.
You need the following scope :
https://www.googleapis.com/auth/youtube.force-ssl

Resources