Firebase CDN unreachable from some networks - firebase

I'm using firebaseui in a web app and I get this error in the console logs:
Loading failed for the with source “https://cdn.firebase.com/libs/firebaseui/3.5.2/firebaseui.js”.
The auth UI itself, as expected, doesn't load. The domain cdn.firebase.com resolves to:
Name: f6.shared.global.fastly.net
Address: 151.101.154.202
It resolves to a different IP address from hosts from which the auth UI loads. Is there anything I could do to ensure that the firebase auth UI loads reliably regardless of where the host is located?
Thanks,
Abhishek

The Firebase UI Web library is hosted on both the cdn.firebase.com and gstatic.com CDNs.
Try using this instead:
<script src="https://www.gstatic.com/firebasejs/ui/3.5.2/firebase-ui-auth.js"></script>
<link type="text/css" rel="stylesheet" href="https://www.gstatic.com/firebasejs/ui/3.5.2/firebase-ui-auth.css" />

Related

Ionic Serve: Accessing google geolocation api via localhost is working, but when the serve address changes its not working

I am a newbie exploring about Ionic Apps.I am running my ionic server on http://localhost:8100. My App need the users current location.
I have added this
<script src="http://maps.google.com/maps/api/js?key=AIzaSyB16sGmIekuGIvYOfNoW9T44377IU2d2Es"></script>
in index.html
And my app.js has
var options = {
enableHighAccuracy: true
};
navigator.geolocation.getCurrentPosition(function(pos) {
$scope.position = new google.maps.LatLng(pos.coords.latitude, pos.coords.longitude);
console.log(JSON.stringify($scope.position));
},
function(error) {
alert('Unable to get location: ' + error.message);
}, options);
And added the following in config.xml
<allow-navigation href="*://*.googleapis.com/*"/>
I got the current location in $scope.position. But the problem comes when I tried running my app in mobile.So,I have connected my ubuntu to my mobile hotspot with IP-192.168.43.86. I tried running my ionic serve on http://192.168.43.86:8100 using
ionic serve --address 192.168.43.86
Now the above getCurrentPosition function is returning error stating
only secured origins are allowed.
So,I'm not sure whats happening there. Both localhost and 192.168.43.86 are http server only. But running the server in localhost has no issue. But changing the address is returning error. Am I missing something? Can someone help?
First, make sure you have whitelisted the IP address you are using to access the maps API in the Google Developer Console. When you are running on a native device, especially iOS, you will also need to include the cordova-plugin-whitelist in order to explicitly whitelist unsecured origins. Here is an example of the meta tag I use for development, it goes in the <head> tag of your index.html:
<meta http-equiv="Content-Security-Policy" content="default-src 'unsafe-inline' 'unsafe-eval' 'self' data: gap: *;">
You can learn more about the cordova whitelist plugin here.

Google push notifications - DOMException: Registration failed - permission denied

I'm following the (getting started with push locations guide) but am running into an error on step 6:
undefined:1 Uncaught (in promise) DOMException: Registration failed - permission denied
My manifest.json file is loading correctly based on the Network tab.
I have entered my correct project number into manifest.json. I have tried adding other settings not mentioned in the guide:
{
"name": "Push Notifications codelab",
"gcm_sender_id": "123456789",
"gcm_user_visible_only": true,
"permissions": [
"gcm"
]
}
I am running my server on localhost as per the guide.
If you're using Brave(the browser) and having the same issue, you have to enable Use Google Services for Push Messaging in the settings.
In order to enable it:
Brave settings > Privacy and Security > Use Google Services for Push Messaging
or use brave://settings/privacy shortcut.
My problem was actually in my settings for Chrome. Under Content Settings, Notifications was set to Do not allow any site to show notifications. Changing this setting to Ask when a site wants to show notifications resolved the issue for me.
DOMException occurs when an operation is impossible to perform, either for logical reasons, because data is lost, or because the implementation has become unstable. You got your error DOMException: Registration failed - permission denied maybe because the manifest was loaded from a different domain than the main page. Suggested from this thread, try to use <link rel="manifest" href="/manifest.json"> if your page is not located at the root of the website. You can also check on this related SO question.

Implementing GIT Kit in .NET Web Api

I'm attempting to implement the GITKit in a Asp .NET Web Api 2 application.
I followed the instructions on the google developer kit. When I go to my sign in page, it redirects to accountchooser.com. So far, so good. I have a google account shown, so I select it. The page reloads, but it is completely blank. No call is received on my sign in successful url. The javascript console shows:
Uncaught Error: At least one sign in option should be specified! gitkit.js:250
Any ideas? What am I doing wrong? How does one debug the various calls to see where things are going haywire?
Thanks.
in your sign in html page where window.google.identitytoolkit.start() is called, you need to pass a configuration object to the start() method with signInOptions defined. Below is an example:
<script type="text/javascript" src="//www.gstatic.com/authtoolkit/js/gitkit.js"></script>
<link type="text/css" rel="stylesheet" href="//www.gstatic.com/authtoolkit/css/gitkit.css" />
<script type="text/javascript">
var config = {
apiKey: '...',
signInSuccessUrl: '/',
signInOptions: ["google", "password"]
};
window.google.identitytoolkit.start(
'#gitkitWidgetDiv', // accepts any CSS selector
config);
</script>

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>

Can I request scripts for use in a Spotify app?

I'm trying to use socket.io in my spotify app and the get request for [domain]/socket.io/socket.io.js keeps getting canceled. I've added the domain to the manifest and everything.
Thanks!
Try restarting Spotify. Your app's manifest.json file is loaded when you first view your app, and cached until you quit, even if you modify it.
Note: How external resource permissions work
In order to request external resources, your application needs to specify each domain it plans to connect to in its manifest.json file.
Add a line like this:
{
// ...
"RequiredPermissions": [ "http://*.spotify.com", "http://spotify.com", "http://test.example.com" ]
// ...
}
For the full details check out the Permissions section of the Spotify Apps API Guide.
I can add that when you use socket.io it will try to initialize Flash to check if flash is available so if you find a white box in Spotify (only in Windows), remove the swbobjects initialization in the socket.io.js on the node server.

Resources