vbNewbie
vbNewbie

Reputation: 3345

youtube api application key validation

Does anyone know if the youtube api has an endpoint or other api to call to verify if an app key is valid? The only option I can think of is to make any call to the api and check if an error is returned for example a search :

https://www.googleapis.com/youtube/v3/videos?part=snippet&id=zzzz&key=xxxxxx

A seperate endpoint that provides perhaps the quota for a key would be useful. Appreciate any help.

Upvotes: 0

Views: 4128

Answers (1)

abielita
abielita

Reputation: 13469

You may refer in this SO post. As stated in your post, you may request a call to the API to verify that your key is working.

https://www.googleapis.com/youtube/v3/search?part=snippet&q=YouTube+Data+API&type=video&key=APIKEY

You may also check this thread: How do I catch an invalid API key for google maps

Google does not offer an external method of checking the Google Maps API key. Hence you cannot query some service with e.g. "Is this code valid abcde1234" and get a TRUE/FALSE response.

There is a discussion on how the Maps API key is generated. But I suggest you look at a post from Mike Williams about the GValidateKey function. This is the function actually doing the magic validation - what it exactly does, like creating a hash from your Google account / domain - we don't know.

Hope this helps!

Upvotes: 4

Related Questions