Google Container Engine REST API Authorization - google-authentication

As mentioned here I created API key for using cluster operations.
For example for this query:
https://www.googleapis.com/container/v1beta1/projects/PROJECT_ID/clusters
And as mentioned
After you have an API key, your application can append the query
parameter key=yourAPIKey to all request URLs.
I added it to url:
https://www.googleapis.com/container/v1beta1/projects/PROJECT_ID/clusters?key=my_key
But i have error:
{
"error": {
"errors": [
{
"domain": "global",
"reason": "required",
"message": "Login Required",
"locationType": "header",
"location": "Authorization"
}
],
"code": 401,
"message": "Login Required"
}
}
I even tried to add key to Authorization part of header...and had this error:
{
"error": {
"errors": [
{
"domain": "global",
"reason": "authError",
"message": "Invalid Credentials",
"locationType": "header",
"location": "Authorization"
}
],
"code": 401,
"message": "Invalid Credentials"
}
}
Where is problem? Or did i something wrong?

According to the Google help documentation for API Keys (emphasis added):
An API key (either a server key or a browser key) is a unique
identifier that you generate using the Developers Console. Using an
API key does not require user action or consent. API keys do not grant
access to any account information, and are not used for
authorization.
Furthermore, it says that they can be used to access data that is public or owned by a Google service. The Google Container Clusters (GKE) data is neither of these. I'm not sure why the documentation suggests using an API key, but I know that OAuth works so if you can use that instead you should be able to get the REST API working.

Related

CMS Strapi any requst Forbidden Error 403

Trying to get data from strapi. I read the instructions
Execute a GET request on the restaurant collection type in order to fetch all your restaurants.
**Be sure that you activated the find permission for the restaurant collection type**
import axios from 'axios';
axios.get('http://localhost:1337/api/restaurants').then(response => {
console.log(response);
});
i create new type "restaurant" in "Content-type builder" and add fields, in "Content manager" created entities of this type. But my answer
{
"data": null,
"error": {
"status": 403,
"name": "ForbiddenError",
"message": "Forbidden",
"details": {}
}
}
I spent a lot of time searching for an answer, but I never found where to activate the find permission. Where is this option?
Do I need to configure JWT validation for that?

How do I call create permissions on Google Drive API via Delphi

I'm trying to use Delphi to call Google Drive Permissions API to create a permission on a team drive. All goes well with the setting on the Google Try It section, but my Delphi code isn't working.
reqPermissions.Body.Add('{role: "organizer",type: "user",emailAddress: "it_admin#mycompany.com"}');
I've tried supplying the type field as a parameter in the Request component, but this also doesn't work. Driving me nuts at the mo, so any help much appreciated.
I always get the following response:
{
"error": {
"errors": [
{
"domain": "global",
"reason": "required",
"message": "The permission type field is required.",
"locationType": "other",
"location": "permission.type"
}
],
"code": 400,
"message": "The permission type field is required."
}
}

Facebook Graph API - How to get scheduler post's all detail in graph API

I'm new in facebook graph API, I want to get all the details of scheduler post like
full_picture
message
etc
I used :
GET v4.0/...?fields={fieldname_of_type_ScheduledPost} HTTP/1.1
Host: graph.facebook.com
But, I got error :
{
"error": {
"message": "(#803) Some of the aliases you requested do not exist: ...",
"type": "OAuthException",
"code": 803,
"fbtrace_id": "A-aQAYXFbAdSX7oMYfcUP_3"
}
}
Ref., https://developers.facebook.com/docs/graph-api/reference/scheduled-post/
The brackets and dots are just placeholders.
Wrong
fields={id,message,...}
Correct
fields=id,message,...
Also, you have to use the ID of a scheduled post instead of just using "..." in the API call.
To get all scheduled posts, use this endpoint: https://developers.facebook.com/docs/graph-api/reference/page/scheduled_posts/
Example:
/me/scheduled_posts?fields=id,message&access_token=<your-page-token>

How to make a basic HTTP request with API key in Google Translate API v2?

I want to make a translation with Google Translate API v2 with a basic HTTP request. I get an API key from the console but I can't find out how to use arguments to make the translation.
Note: I want it to autodetect the source language and I only want to choose the target language.
This is the URL that I tried to use:
https://translation.googleapis.com/language/translate/v2/detect?fields=detections&key=BIzaSyA8uHGnsA8ICcBWWJcxhqVePGFMq0L4u0g&q=grapes&target=es
It returns this:
{
"error": {
"code": 400,
"message": "Request contains an invalid argument.",
"errors": [
{
"message": "Request contains an invalid argument.",
"domain": "global",
"reason": "badRequest"
}
],
"status": "INVALID_ARGUMENT"
}
}
See the documentation.
The authentication token goes in the Authorization request header, not the query string.

Error creating Facebook test user

I am following the instructions at http://developers.facebook.com/docs/test_users/
When I do:
https://graph.facebook.com/APP_ID/accounts/test-users?
installed=true
&name=Fred
&locale=en_US
&permissions=read_stream
&method=post
&access_token=XXXXXXXXX
I get:
{
"error": {
"message": "(#803) Some of the aliases you requested do not exist: APP_ID",
"type": "OAuthException",
"code": 803
}
}
How do I fix this?
The issue is that you are using the string APP_ID instead of your app's id.
Further Explanation
I was able to duplicate the bug myself with the following steps:
Getting a App Access Token:
https://graph.facebook.com/oauth/access_token?client_id=YOUR_APP_ID&client_secret=YOUR_APP_SECRET&grant_type=client_credentials
where YOUR_APP_ID and YOUR_APP_SECRET were replaced with the correct values from https://developers.facebook.com/apps
Using the provided access token, appending it to the url.
https://graph.facebook.com/APP_ID/accounts/test-users?installed=true&name=Fred&locale=en_US&permissions=read_stream&method=post&access_token=YOUR_ACCESS_TOKEN
which result in
{
"error": {
"message": "(#803) Some of the aliases you requested do not exist: APP_ID",
"type": "OAuthException",
"code": 803
}
}
Replacing APP_ID with the proper app id, also from https://developers.facebook.com/apps resulted in the correct response.
I used the following method and it works:
https://graph.facebook.com/YOUR_APPID/accounts/test-users?access_token=YOUR_ACCESS_TOKEN&installed=true&locale=en_GB&permissions=read_stream,read_friendlists,publish_stream
the APP_ACCESS_TOKEN :
Creating an APP_ACCESS_TOKEN is really easy. You can use your App ID/API Key and App secret
YOUR_ACCESS_TOKEN = YOUR_APP_ID|YOUR_APP_SECRET
Example: 1234587968 | bghyuifjk3438483249235903502035023504305