You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I do have the following code example. The API key is not valid. I expect this component to get an ERROR status in case the API key is invalid. But what I get is a SUCCESS status.
<WrapperapiKey="I am an invalid API Key"render={(status)=>{console.log('STATUS: '+status);return<div/>;}}/>
For me, it looks like a bug. Or is this behavior wanted?
The text was updated successfully, but these errors were encountered:
andrmoel
added
triage me
I really want to be triaged.
type: bug
Error or flaw in code with unintended results or allowing sub-optimal usage patterns.
labels
Feb 3, 2023
But from a quick look, it doesn't seem like the JavaScript API supports any error handling for API key issues other than its own error handling. The "error" status here would only appear if the JavaScript API itself couldn't be fetched or parsed from the Google API server.
That is something that just can't be implemented with the way the Google Maps API is loaded.
The reason is relatively simple: The API key is not (and can't be) validated on the server. So when the API is loaded, it doesn't yet know if the key is valid. This validation needs another request that is sent after the API is loaded.
In order to avoid delaying your map initialization any more than neccessary, the API will report load success once it is ready to be used. Validating the API key happens "in the background".
There is only one way to know that the API key is invalid: you can specify a callback function window.gm_authFailure that will get called if the validation fails. But when this is called (if even), the initialization is likely already complete.
usefulthink
added
status: will not fix
Invalid (untrue/unsound/erroneous), inconsistent with product, not on roadmap.
and removed
type: bug
Error or flaw in code with unintended results or allowing sub-optimal usage patterns.
triage me
I really want to be triaged.
labels
Feb 23, 2024
I do have the following code example. The API key is not valid. I expect this component to get an ERROR status in case the API key is invalid. But what I get is a SUCCESS status.
For me, it looks like a bug. Or is this behavior wanted?
The text was updated successfully, but these errors were encountered: