3
I am making an application, where I will have to validate a google maps API key. The problem is that I do not know what standards it follows:
AIzaSyA-OlPHUh2W7LUZXVjQjjxQ8fdCWdAASmc
Here it is visible that they are capital letters and minuscules, numbers and dashes. But will always be so?
Someone knows the pattern of these keys, and how to do this with JS and PHP?
JS:
var inputstr="A3aa622-_";
var regex=/^[A-Za-z0-9-_]{30,50}$/g;
if (regex.test(inputstr)){
alert("sim");
}else{
alert("Nao");
}
I think the only way to validate them would be to perform a GET/POST for the API using such a key. This way the API should return whether the key is true or not.
– Inkeliz
I get it. At the moment I don’t care much if the api is true or false, I would like to validate more, so that the suit doesn’t add anything, something like that, would it help:
regex=/^[A-Za-z0-9-_]{30,50}$/g;
– abcd