Add token is source #4902
Unanswered
sylvain258
asked this question in
Q&A
Replies: 2 comments 4 replies
-
It is not clear what "it doesn't work" mean, tarnsfromRequest is the means to achieve the required behavior. |
Beta Was this translation helpful? Give feedback.
0 replies
-
I inserted this "transformRequest" in my code, in the map declaration. I can't display my VT layer. I have a return that my token is not found. |
Beta Was this translation helpful? Give feedback.
4 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hello,
I would like to know how to allow a source to access a VT url with an authorization token. I have an API that produces VTs but only allows access if you have a token.
I found in map options, there is an option "transformRequest" where it's possible to put an access token in the header. But it doesn't work.
transformRequest: (url, resourceType) => { if (resourceType === 'Source' && url.startsWith('http://myHost')) { return { url: url, headers: { 'Authorization': 'Bearer ' + yourAuthToken } } } }
Thanks
Beta Was this translation helpful? Give feedback.
All reactions