Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support for API authentication #53

Open
jussih opened this issue Dec 6, 2022 · 3 comments
Open

Support for API authentication #53

jussih opened this issue Dec 6, 2022 · 3 comments
Labels
enhancement New feature or request PR accepted Feel free to offer a Pull Request for this specific issue

Comments

@jussih
Copy link
Contributor

jussih commented Dec 6, 2022

Some tile sources, like the Maanmittauslaitos WMTS api (page in Finnish only) in Finland, require API authentication to fetch tile data.

In my use case I was able pass the api key as part of the tile url as an url parameter. However it would be more robust to be able to add it as a header for the http requests.

I propose two mechanisms to support api authentication. These could be optional configuration in the printSpec.

  • ability to add query params as key/value pairs
  • custom headers that will be used for the tile requests
@jahow
Copy link
Member

jahow commented Dec 6, 2022

I guess we could add an option for custom headers for each layer that relies on HTTP requests. For query params, including them in the provided url should be enough!

@jahow jahow added enhancement New feature or request PR accepted Feel free to offer a Pull Request for this specific issue labels Dec 6, 2022
@jahow
Copy link
Member

jahow commented Dec 22, 2022

Just started looking into this but adding HTTP headers to WMS/WMTS layers for example might be trickier than I thought. We're relying on native img elements to load the tiles, and there's no way to specify custom headers with that method. This means we'd have to switch to loading the image data ourselves using fetch, which will be more work.

@jussih could you please confirm that this is needed, e.g. in the case of a tile service protected by Basic Auth? thanks!

@jussih
Copy link
Contributor Author

jussih commented Dec 22, 2022

For the current sources that I'm using this is not needed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request PR accepted Feel free to offer a Pull Request for this specific issue
Projects
None yet
Development

No branches or pull requests

2 participants