Get hands-on experience with 20+ free Google Cloud products and $300 in free credit for new customers.

API key invalid after one use, using the Google Cloud Vision package for MIT App Inventor

Hello

 

Pretty exciting to see this worked quickly, but i hit a snag!

I started using this package in the MIT App Inventor 2

Google Cloud Vision - Extensions - MIT App Inventor Community

It does what it says the first time, but the second and subsequent times it returns this error: 

Error from Cloud: API Key not valid. Please pass a valid API key

Any ideas why it may happen?

Code below 

festrella_0-1699848414074.png

Google Bard said:

There are a few possible reasons why your API key might work once but not the next time:

  • Your API key might have expired. API keys typically have an expiration date. If your API key has expired, you will need to create a new API key.
  • Your API key might have been revoked. API keys can be revoked for a variety of reasons, such as if they are compromised or if they are no longer needed. If your API key has been revoked, you will need to create a new API key.
  • There might be a problem with the Google Cloud Vision API. If you are experiencing problems with the Google Cloud Vision API, you can check the Google Cloud Platform status page to see if there are any known issues.




    The only thing that applies is if it was revoked. Does this happen regularly?

    It works if I reload the app

 

1 1 3,546
1 REPLY 1

Hi @festrella ,

I believe the likely cause for this could be one of the below reasons:
1) The API key has indeed expired. In which case you would need to request/create a new key.

2) Can you confirm if you are using a Server key, since you need to use a browser key. The Vision API Getting Started page has detailed screenshots, as well as a curl example.

3) Highly unlikely, but confirm if you are trying to use the api key in the correct project.

You may also want to check for errors in the cloud audit logs.

Kind Regards,

SanketK

Top Labels in this Space
Top Solution Authors