Angular Meteor Socially Tutorial - Google Maps not loading - MissingKeyMapError - meteor

I am getting this error when trying to load google maps
Google Maps API error: MissingKeyMapError
I am accessing the application on my localhost http://localhost:3000/
After googling I noticed that an API key needs to be passed to resolve this error, but how do I pass this key? I don't see any attributes related to this key for sebm tag.
Party-detail.html has the following:
<sebm-google-map
[latitude]="lat || centerLat"
[longitude]="lng || centerLng"
[zoom]="8"
(mapClick)="mapClicked($event)">
<sebm-google-map-marker
*ngIf="lat && lng"
[latitude]="lat"
[longitude]="lng">
</sebm-google-map-marker>
</sebm-google-map>

You may place following the script in your index.html file
<script src="https://maps.googleapis.com/maps/api/js?key=YOUR_GOOGLE_MAPS_API_KEY_HERE"></script>
before
<script src="build/js/app.bundle.js"></script>
and you may manage an api key form
https://developers.google.com/maps/documentation/javascript/

Related

Getting "API Key not found. Please pass a valid API key" from GCP Identity Platform but the Key is absolutely correct

I am trying to follow the tutorial here:
https://www.youtube.com/watch?v=ny92vcpOQFs
...but I get a 400 error back with the message "API Key not found. Please pass a valid API key".
The code section where the API key is provided is literally copied right from the GCP Identity Platform interface, and I have checked it multiple times.
I don't know where to go from here, all the tutorials just take it for granted that this works.
The minimal reproduction is as follows, although I get the same result if I try to use firebase-ui-auth:
<!DOCTYPE html>
<html>
<head>
<title>Identity Platform Test</title>
<script src="https://www.gstatic.com/firebasejs/8.0/firebase.js"></script>
<script> //this section copied directly from GCP
var config = {
apiKey: '<Private but 100% correct>',
authDomain: 'my-site.firebaseapp.com',
};
firebase.initializeApp(config);
</script>
<script>
let email = 'private#gmail.com';
let pw = 'private';
firebase
.auth()
.signInWithEmailAndPassword(email, pw)
.then((ac) => {
console.log('It worked.');
})
.catch((error) => {
console.log(error.toString());
});
</script>
</head>
<body>
Test
</body>
</html>
Just an update to say I've followed the instructions on both of these pages, made sure I have all the pre-requisites, etc. I feel like there's some underlying assumption that is made but not communicated:
https://medium.com/#ThatJenPerson/whos-there-implementing-identity-platform-for-web-c210c6839d3b
https://cloud.google.com/identity-platform/docs/web/google
It seems like a bug in GCP/Identity Platform.
If you start in Identity Platform, it will generate an API key for you. If you look at the Firebase console, the API Key will match there. ...but it won't work (for anything it seems).
If you then create an app (seemingly any app) it will regenerate the project API Key (which doesn't seem right). You don't need any of the App configuration information - just the apiKey and authDomain are required from the project, but now the API key (at the project level, not the App level) is regenerated (and GCP Identity Platform will now reflect this new key), and that newly generated API Key will work correctly.
The app can just be an HTML file sitting on your local computer and it will still work - but only if you set up SOME app in Firebase (even though you never use it for anything).
It seems problematic that both the projectId and appId are missing from the config. In my multiple Firebase authentication implementations, I always include those.
Inside your Firebase Project Settings, scroll down and copy the entire config just to be certain:
https://console.firebase.google.com/u/0/project/<YOUR_PROJECT_NAME_HERE>/settings/general
**EDIT (MORE INFO)
After visiting https://console.firebase.google.com and selecting your project, click the little gear icon in the top left > Project Settings > (scroll all the way down to the code sample they give you)
You would see something like this:
In this screenshot (purposely cut-off) you'll see:
const firebaseCon....
That's the entire config you need to be using - I've setup dozens of Firebase Firestore projects with all services and I don't leave out the projectId and appId ever.
Another thing to make sure of is that your Firebase Authentication has Email / Password enabled. Go to Build > Authentication > Sign-in method. Then make sure you've added and enabled Email/Password option.

Return custom error from appengine behind Google Cloud Endpoints

I am using flask and python 3.6 as a backend service that is deployed to App Engine in GCP. This backend is sitting behind Google Cloud Endpoints deployed in Cloud Run. Endpoints takes all my 404 messages and just returns 404 Not Found. I want to send a more informative error message with the 404 code. Is there any way to do so using my current setup? Thanks
You can create a custom 404 html page:
#app.errorhandler(404)
def page_not_found(e):
return render_template('404.html'), 404
Then, you need to create 404.html file.
You can use the Python Endpoints library to send HTTP error codes with a custom message as follows:
message = 'No entity with the id "%s" exists.' % entity_id
raise endpoints.NotFoundException(message)
You can find more info in the docs

Google Maps Api Error: InvalidKeyMapError

I developed an application in Asp.net where I used bees google map for libraries places.
I plugged in the "Maps API bootstrap URL" address for debugging the application, but unfortunately I get the error "Google Maps Api Error: InvalidKeyMapError"; the address is inserted:
*http://localhost /*
and I've also included:
*http://localhost:1055/* changing the application, but unfortunately I always get the error; I added the pages where name is the url of google, but unfortunately I always get the error ...
How do I call up localhost bees google?
Many thanks to those who respond
dave

Linkedin Javascript SDK - Setting the SDK Domains in the app configuration page has no effect

No matter how hard I try, and no matter the url format I'm giving in the Setting the SDK Domains section of the Linkedin Javascript SDK, I keep getting this error in my console:
Uncaught Error: You must specify a valid JavaScript API Domain as part of this key's configuration.
My setup it's as simple as possible :
<script type="text/javascript" src="//platform.linkedin.com/in.js">
api_key:afyXZGKtvrVoXXXX
</script>
I've tried all the URL variations in the SDK Domains section:
having localhost with and without port ( http://localhost:9000 )
having a custom hostname with and without port ( http://dev.local:9000 )
having a real existing domain name ( heroku app ) (http://somename.herokuapp.com)
Nothing worked, keep getting the same error.
Any advice appreciated.
Thank you,
Try this:
<script type="text/javascript" src="//platform.linkedin.com/in.js">
api_key:afyXZGKtvrVoXXXX
authorize: true
</script>

Google Analytics and the __utm.gif file

When using Google Analytics and using the newer ga.js file, is the __utm.gif file needed in your root directory of your web site?
I do see a call being made from my browswer to the file on google-analytics.com (http://www.google-analytics.com/__utm.gif?...), but in the past I was told that it needed to exist in the root of the site.
Does this still hold true?
Could you please provide a reference?
If you are using the new version of the tracking code (ga.js), the only thing you need to do is include this snippet of JavaScript:
<script type="text/javascript">
var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www.");
document.write(unescape("%3Cscript src='" + gaJsHost + "google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E"));
</script>
<script type="text/javascript">
var pageTracker = _gat._getTracker("UA-xxxxxx-x");
pageTracker._trackPageview();
</script>
This would imply that there are no requirements for you to host any __utm.gif file on your server (I'm not sure how this would even work for analytics anyway, as the whole point is for the client's browsers to make requests to Google's servers).
I use the older urchin.js tracking mechansim and there are no requirements to host anything locally although you can put the .js file on your server for speed. There are four images that get requested to provide the tracking; __utma, __utmb, __utmc and __utmz which correspond to they cookies recorded of the same name.
From Google; When you first begin implementing tracking in Google Analytics website, you need to install the tracking code on your website pages. The generic tracking code snippet consists of two parts: a script tag that references the ga.js tracking code, and another script that executes the tracking code.
You are required to add _utm.gif to your server root if you are also sending a copy of the google analytics data to your local webserver. It gives you the option of keep the data much longer since Google is only keeping 25 months of data for free account.
Google also doesn't share the raw data, the only way to get the raw data is also sending it to your local webserver log. For it to work, you need to add this line below to the tracking code:
_gaq.push(['_setLocalRemoteServerMode']);
For more detailed discussion, please refer to the book by Clifton, Brian (2012-03-30). Advanced Web Metrics with Google Analytics (Kindle Locations 4459-4460). John Wiley and Sons.

Resources