maptiler / qgis-maptiler-plugin

QGIS MapTiler Plugin: vector tiles, basemaps, geocoding, OSM, QuickMapServices
GNU General Public License v2.0
84 stars 10 forks source link

Access denied on two computers #194

Closed lmurta closed 1 month ago

lmurta commented 1 month ago

Hi, I installed the plugin on my home PC and on my office notebook and I'm using the same MapTiles account and credentials on both computers. I can create new projects and new layers on both computers but when I try to open a file created in one computer on the other computer I get the following error and the layers are not loaded: MapTiler Planet: Access denied: Missing key - Get your FREE key at https://cloud.maptiler.com/account/keys/

QGIS version 3.34.9-Prizren QGIS code revision cbbc7bdfb66 Qt version 5.15.3 Python version 3.10.12 GDAL/OGR version 3.4.1 PROJ version 8.2.1 EPSG Registry database version v10.041 (2021-12-03) GEOS version 3.10.2-CAPI-1.16.0 SQLite version 3.37.2 PDAL version 2.3.0 PostgreSQL client version 14.12 (Ubuntu 14.12-0ubuntu0.22.04.1) SpatiaLite version 5.0.1 QWT version 6.1.4 QScintilla2 version 2.11.6 OS version Ubuntu 22.04.4 LTS

Active Python plugins qgis-maptiler-plugin 3.3 grassprovider 2.12.99 db_manager 0.1.20 processing 2.12.99

lazaa32 commented 1 month ago

Hi, when you install the plugin on your office laptop and insert the credentials they will save into qgis-auth.db under a generated id let's say laptopID (but in reality it's a just random string). You can see it in Settings/Options/Authentication/Configuration.

If you do the same and install the plugin on your Home PC, and you insert the same credential, they will save into qgis-auth.db but under a different id, let's say HomePcID.

Now, when you save a project on on your office laptop, in the project file there is a reference to the crendentials id (laptopID) from your laptop. But then you open the project on your home PC and the reference of the id laptopID is not working because there is no such id in yout authentication DB on your home PC, there is only homePcID saved. What I'm trying to say is that not all settings saved in project file is possible to transfer between two computers without issues.

Solution: If you saved the project on your office laptop then go to QGIS/Settings/Options/Authentication and copy the id (laptopID)(there might be more configurations saved, you want the one of MapTilerHmacSha256 type). Then open QGIS on your home PC, go to Settings/Options/Authentication, click on the configuration of MapTilerHmacSha256 type and click on Edit button (under Plus and Minus buttons on the right side). There you can change the original id (HomePcID) for a new one (laptopID) - you might have to click on the lock button to be able to edit the id. Now you have the MapTiler credentials saved under the same id both on your laptop and your home PC and you can share projects between two computers.

Solution2: On your laptop, go to QGIS/Settings/Options/Authentication, click on the configuration of MapTilerHmacSha256 type, then click on Utilities/Export selected Authentication configuration to File.... Save into a file. Transfer the file on your home PC and again go to QGIS/Settings/Options/Authentication, click on Utilities/Import Authentication configuration from File..., select transfered file from your laptop and then you will have the MapTiler credentials saved on both computers under the same id and you can share projects.

image

Please, let me know, if that helped.

lmurta commented 1 month ago

Yes, solution 1 works! Thank you.