Page 1 of 1

PackageViewer (iOS) & GoogleMap HTTP referrer ?

Posted: Sun May 02, 2021 8:33 pm
by Peres
May I ask -
What would be a correct HTTP referrer in the GoogleMap API Credentials section, for showing map content in projects uploaded to the PackageViewer (iOS) ?
A HTTP referrer of localhost:1234/* (or similar) works in Safari but not in iOS.

Thanks & best regards,
Rainer

Re: PackageViewer (iOS) & GoogleMap HTTP referrer ?

Posted: Mon May 03, 2021 9:19 pm
by Hopki
Hi Rainer,
Only do this if the tour is going to be loaded in the APP and no one can download the package.
So basically only you using it on your device, otherwise use OpenStreetMap as it's free.
If you leave the HTTP blank and it will then be open.

Screenshot 2021-05-03 at 20.16.22.png
Screenshot 2021-05-03 at 20.16.22.png (27.33 KiB) Viewed 4593 times

Regards,

Re: PackageViewer (iOS) & GoogleMap HTTP referrer ?

Posted: Tue May 04, 2021 3:56 pm
by thomas
The files in the package viewer are opened with the "file:" protocol. In the Google API key restrictions you need to use the macro __file_url__ to make the work. So with

Code: Select all

__file_url__/*   
you can allow Google Maps in the package, and also prevent others from using your key on their website.
Screen Shot 2021-05-25 at 12.01.26.png
Screen Shot 2021-05-25 at 12.01.26.png (57.67 KiB) Viewed 4302 times

Re: PackageViewer (iOS) & GoogleMap HTTP referrer ?

Posted: Tue May 04, 2021 4:34 pm
by Peres
Thanks a lot Hopi and Thomas, for your advice and the warning about the referrer.
Much appreciated.

Best regards,
Rainer

Re: PackageViewer (iOS) & GoogleMap HTTP referrer ?

Posted: Mon May 17, 2021 7:04 pm
by Peres
Hello Thomas,
Hello Hopki,

my apologies but I haven't managed to follow your kind advice.
The key question is how to set the __file_url__ macro correctly.
Below is what I've tried.
All file/path names given are symbolic.

1.
Project Example-Test.p2vr on macOS, connected to Google Map APIs
Saved on local drive.
API: Maps JavaScript with application restriction HTTP referrer *localhost:12345/abcdefg/*
### Works including GoogleMaps access

2.
Saved Example-Test.p2vr as package, Example-Test.ggpkg, on local drive
Uploaded to iCloud Drive
### Opens in Package Viewer, without GoogleMaps connection

3.
URL of Example-Test.p2vr as indicated on iCloud Drive (Web):
https://www.icloud.com/iclouddrive/uvwx ... ple%5FTest

4.
Google Cloud Platform, Project selected, Credentials, Restrictions for API "Maps JavaScript API"
Application restrictions (type) : HTTP referrers (websites)
Website restrictions (for Pano2VR, macOS): *localhost:12345/abcdefg/*
Website restrictions (for Package Viewer, ipadOS): *www.icloud.com/iclouddrive/uvwxyz987654#Example%5FTest*
Saved in Google Cloud Platform.
See screenshot below, please.
Re-started Package Viewer on ipadOS
### Opens in Package Viewer, but still without GoogleMaps connection
### Error Message "page didn't load GoogleMaps correctly. See the JavaScript console ..."

Question:
Which is the correct way of entering file and url correctly ?
With the data above in your example __file_url__* ?


Thank you so much for your help & best regards,
Rainer

Re: PackageViewer (iOS) & GoogleMap HTTP referrer ?

Posted: Fri May 21, 2021 4:53 pm
by Peres
Might I ask you to have another look at the issue ?

Correct __file_url__ macro setup
PackageViewer (iOS) & GoogleMap HTTP referrer

Thanks a lot for your help & best regards,
Rainer

Peres wrote: Mon May 17, 2021 7:04 pm Hello Thomas,
Hello Hopki,

my apologies but I haven't managed to follow your kind advice.
The key question is how to set the __file_url__ macro correctly.
Below is what I've tried.
All file/path names given are symbolic.

1.
Project Example-Test.p2vr on macOS, connected to Google Map APIs
Saved on local drive.
API: Maps JavaScript with application restriction HTTP referrer *localhost:12345/abcdefg/*
### Works including GoogleMaps access

2.
Saved Example-Test.p2vr as package, Example-Test.ggpkg, on local drive
Uploaded to iCloud Drive
### Opens in Package Viewer, without GoogleMaps connection

3.
URL of Example-Test.p2vr as indicated on iCloud Drive (Web):
https://www.icloud.com/iclouddrive/uvwx ... ple%5FTest

4.
Google Cloud Platform, Project selected, Credentials, Restrictions for API "Maps JavaScript API"
Application restrictions (type) : HTTP referrers (websites)
Website restrictions (for Pano2VR, macOS): *localhost:12345/abcdefg/*
Website restrictions (for Package Viewer, ipadOS): *www.icloud.com/iclouddrive/uvwxyz987654#Example%5FTest*
Saved in Google Cloud Platform.
See screenshot below, please.
Re-started Package Viewer on ipadOS
### Opens in Package Viewer, but still without GoogleMaps connection
### Error Message "page didn't load GoogleMaps correctly. See the JavaScript console ..."

Question:
Which is the correct way of entering file and url correctly ?
With the data above in your example __file_url__* ?


Thank you so much for your help & best regards,
Rainer

Re: PackageViewer (iOS) & GoogleMap HTTP referrer ?

Posted: Tue May 25, 2021 12:08 pm
by thomas
Sorry, I made a small mistake. The URL should be __file_url__/* (the original post had a missing "/"). I fixed the original post, to make it easier for people to find the solution. You literally put __file_url__/* into the URL field as shown in the screenshot, as the actual path on your device is unknown, for security reasons. Also, iOS/Android may change those paths with newer OS versions.