Referring to the following link https://cloud.google.com/sql/docs/mysql/admin-api/how-tos/authorizing . I've tried on the apikey but no success. The response from the API as follows;
//https://www.googleapis.com/sql/v1beta4/projects/<projectid>/instances/<instanceid>/databases?key=<API_KEY>
{
"error": {
"code": 401,
"message": "Request is missing required authentication credential. Expected OAuth 2 access token, login cookie or other valid authentication credential. See https://developers.google.com/identity/sign-in/web/devconsole-project.",
"errors": [
{
"message": "Login Required.",
"domain": "global",
"reason": "required",
"location": "Authorization",
"locationType": "header"
}
],
"status": "UNAUTHENTICATED"
}
}
I've no issue with oAUth 2.0, hence would like to confirm if authorization through api key is no more supported?
I tested get information from the endpoint using only the API key and is not possible to retrieve information, since is necessary to use an authentication bearer.
I used these commands to get the databases information
export TOKEN=`gcloud auth application-default print-access-token`
curl -X GET \
https://sqladmin.googleapis.com/sql/v1beta4/projects/[MY PROJECT ID]/instances/[MY INSTANCE NAME]/databases \
-H 'authorization: Bearer '"$TOKEN"''
Since this request has sensitive data (non public) is necessary the OAuth token and the api key is not mandatory, as is stated on this document.
Looks like key parameter is not anymore necessary.
Related
I am trying to add Azure B2C as on OIDC provider for Firebase Auth. The implicit flow works fine but the code flow fails with either of the following errors :
Malformed response cannot be parsed from oidc.<provider_name> for CODE_EXCHANGE
or
Invalid OAuth response from oidc.<provider_name>
On investigation I found that the last call where this failure happens is this :
curl --location --request POST 'https://www.googleapis.com/identitytoolkit/v3/relyingparty/verifyAssertion?key=<web_key>' \
--header 'Content-Type: text/plain' \
--data-raw '{
"returnSecureToken" : true,
"requestUri" : "https://<firebase_project_name>.firebaseapp.com/__/auth/handler?state=<state_goes_here>&code=<authcode_flow_code>",
"postBody" : "providerId=oidc.<provider_name>",
"sessionId" : "<random_session_id>",
"autoCreate" : true,
"returnIdpCredential" : true
}'
Response for this request comes as :
{
"error": {
"code": 400,
"message": "INVALID_IDP_RESPONSE : Invalid OAuth response from oidc.<provider_name>",
"errors": [
{
"message": "INVALID_IDP_RESPONSE : Invalid OAuth response from oidc.<provider_name>",
"domain": "global",
"reason": "invalid"
}
]
}
}
I tried checking Firebase logs but no helpful information available. However, I did noticed that Firebase exchanged this code for the id_token successfully from Azure B2C before failing and returning 400 error.
Any help in this regard?
I'm trying to use your AMADEUS API but i have trouble to display hotels offers on production environment ..
Note that everything is ok on sandbox.
On https://api.amadeus.com endpoint I do :
/v1/security/oauth2/token to get an access token
then add the access token as bearer authentication
Then launch the request /v2/shopping/hotel-offers/?cityCode=NCE
((( Same as the sandbox )))
Here the response :
"errors": [
{
"status": 401,
"code": 701,
"title": "Wrong authentication credentials.",
"source": {
"pointer": "uri"
}
}
]
So I test the token on /v1/security/oauth2/token/{{XXXXXXXX}}
The token is not expired and approuved.
Anyone to help?
Thank you so much (sorry for english mistakes)
Akim
I am trying to translate some text using GCP translation service with REST api https://translation.googleapis.com/v3
I'm using API key auth method.
url and
Body
https://translation.googleapis.com/v3/projects/my-translator-1122333:translateText?key=thisismykey
{
"content": ["Hello"],
"sourceLanguageCode": "en",
"targetLanguageCode": "ru"
}
However I got
{
"error": {
"code": 401,
"message": "Request is missing required authentication credential. Expected OAuth 2 access token, login cookie or other valid authentication credential. See https://developers.google.com/identity/sign-in/web/devconsole-project.",
"status": "UNAUTHENTICATED"
}
}
Could anyone explain me what is wrong I do?
Thanks
i'm trying to get unlisted videos from a user authenticated by api key
https://www.googleapis.com/youtube/v3/search?part=snippet&forMine=true&type=video&maxResults=50&key=keyremoved
i receive the error
"error": {
"errors": [
{
"domain": "youtube.search",
"reason": "invalidSearchFilter",
"message": "The request contains an invalid combination of search Note that you must set the \u003ccode\u003etype\u003c/code\u003e parameter to \u003ccode\u003evideo\u003c/code\u003e if you set a value for the \u003ccode\u003eeventType\u003c/code\u003e, \u003ccode\u003evideoCaption\u003c/code\u003e, \u003ccode\u003evideoCategoryId\u003c/code\u003e, \u003ccode\u003evideoDefinition\u003c/code\u003e, \u003ccode\u003evideoDimension\u003c/code\u003e, \u003ccode\u003evideoDuration\u003c/code\u003e, \u003ccode\u003evideoEmbeddable\u003c/code\u003e, \u003ccode\u003evideoLicense\u003c/code\u003e, \u003ccode\u003evideoSyndicated\u003c/code\u003e, or \u003ccode\u003evideoType\u003c/code\u003e parameters.",
as you can see my get request contains a type=video parameter.
When i try https://developers.google.com/apis-explorer/#p/youtube/v3/youtube.search.list?part=snippet&forMine=true&maxResults=50&type=video
with logged in the youtube account using oauth2 it works fine
You can't use an API key for the forMine parameter.
You need to send an authorized OAuth2 request for it to work.
$ curl --header "Authorization: Bearer <YOUR_ACCESS_TOKEN>" https://www.googleapis.com/youtube/v3/search?part=snippet&type=video&forMine=true&maxResults=50
{
"kind": "youtube#searchListResponse",
"etag": ...
https://developers.google.com/youtube/v3/docs/search/list#forMine
Using OAuth code i am able to generate access token for google+ API .
using this access token in oauthpalyground iam getting JSON response .
When I paste this this URL into a browser am get an error message.
https://www.googleapis.com/plus/v1/activities?query=%22great%22&access_token=xxxxxxxxxxx
Error Message
{
"error": {
"errors": [
{
"domain": "global",
"reason": "insufficientPermissions",
"message": "Insufficient Permission"
}
],
"code": 403,
"message": "Insufficient Permission"
}
}
Can anyone explain to me why?
You can not query directly from browser sending the access_token as a querystring. You must send access_ token in headers this way:
Authorization: Bearer <access_token>
Try it with Fiddler or some similar software.