Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can't create client only with API key #252

Closed
Jofre opened this issue Feb 14, 2018 · 7 comments
Closed

Can't create client only with API key #252

Jofre opened this issue Feb 14, 2018 · 7 comments
Assignees
Labels
type: question Request for information or clarification. Not an issue.

Comments

@Jofre
Copy link

Jofre commented Feb 14, 2018

https://github.com/google/google-api-go-client/blob/b0284fdf28b5e4d7c9aa5c26e67035437f711304/internal/settings.go#L34

If the apiKey is is set, it still tries to get application default credentials.

This produces errors like this: https://play.golang.org/p/tBtH1v-Sj5w

The same call using curl works (no credentials):

curl https://vision.googleapis.com/v1/images:annotate?key=<API_KEY>  -H'content-type:application/json' -d'{
 "requests": [
  {
   "image": {
    "source": {
     "imageUri": "https://upload.wikimedia.org/wikipedia/commons/thumb/2/2f/Google_2015_logo.svg/1200px-Google_2015_logo.svg.png"
    }
   },
   "features": [
    {
     "type": "LABEL_DETECTION"
    }
   ]
  }
 ]
}'
@0joshuaolson1
Copy link

0joshuaolson1 commented Mar 15, 2018

I was surprised that GettingStarted says without exception to use Google's OAuth package and no example shows using WithAPIKey on its own.

...now I know why?

Workaround: (personal) fork for one's simple needs?

@broady
Copy link
Contributor

broady commented Mar 15, 2018 via email

@0joshuaolson1
Copy link

OTOH, I just found this example code in an issue, so maybe this is possible already?

@broady
Copy link
Contributor

broady commented Mar 15, 2018 via email

@0joshuaolson1
Copy link

0joshuaolson1 commented Mar 15, 2018

The YouTube Data API v3 doesn't need OAuth for some things.

ALSO: The nodejs JavaScript client uses api keys happily for those cases.

@broady
Copy link
Contributor

broady commented Mar 15, 2018 via email

@JustinBeckwith JustinBeckwith added the type: question Request for information or clarification. Not an issue. label Jun 7, 2018
@jba jba self-assigned this Jun 7, 2018
@jeanbza jeanbza added type: docs Improvement to the documentation for an API. type: question Request for information or clarification. Not an issue. and removed type: question Request for information or clarification. Not an issue. type: docs Improvement to the documentation for an API. labels Oct 19, 2018
@jeanbza
Copy link
Member

jeanbza commented Oct 19, 2018

This question seems resolved. I'm going to close, but anyone feel free to speak up if we should take another look at this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: question Request for information or clarification. Not an issue.
Projects
None yet
Development

No branches or pull requests

6 participants