Geolocation not possible due to "Only secure origins are allowed (see:"


Hi everyone,

I’m creating an app that needs to access the GPS location of the user on some occasions. I followed this tutorial, including the meta tag and permissions, but still get the following error:

Only secure origins are allowed (see:

I searched for the error message and it shows that this error occurs in chrome when the website is not served via HTTPS. Since I get the same error in the emulator and when debugging on the phone, I am not sure how to resolve this error when dealing with Ionic. I use Ionic 1.3.1.

Any help or hints are greatly appreciated, thanks!

Geolocation is not working on android
PositionError {code: 1, message: "Only secure origins are allowed ionic3?

I’m in the exact same position.

Long story short, the problem is some change on the security policies on Google’s side. The tutorial you refer to needs an update to reflect this change which took effect last April.

Sorry, I don’t know how to fix the code. But as a consolation, I’ll tell you that you can see your ionic page correctly displayed with Firefox. Just do:

  1. ionic build android
  2. ionic serve

… and make sure you’re opening the URL with Firefox.



I was wondering if you were able to fix this issue? Looking at my app in Firefox works fine, but at some point one should be able to make the app work in the real device.

Many thanks.


I use this meta:

<meta http-equiv=“Content-Security-Policy” content=“default-src ‘self’ gap://ready file://* *; style-src ‘self’ ‘unsafe-inline’; script-src ‘self’ ‘unsafe-inline’ ‘unsafe-eval’”/>

and the app works well.


this is not working for me, anyone could help me?


Hello, this may be a bit to late. but can i ask you whether you have solve this problem or not?


I get the same error. ‘only secure origins are allowed’.
this is on android real device.