I’m experimenting with Squidex again, to see if I can use it through the KrakenD API Gateway.
I’ve found an odd thing when I tried to setup a “read only” scenario, where KrakenD receives the requests without any token and forwards them to Squidex with a readonly token. (Midway gets the token from Squidex/IdentityServer)
The Go implementation of url encoding doesn’t allow : characters in the url components.
So if I have a clientId: app_name:readonly
KrakenD forwards: app_name%3Areadonly.
In the golang net/url package the implementation of url escaping is: https://golang.org/src/net/url/url.go?s=25313:25344#L150
In the code they are referring to some RFC stuff, and based on that I’m assuming that the : is not allowed in the query string. Or the golang implementation is just wrong?
In the light of the above shouldn’t Squidex support a fallback character instead of : in the client_id?
It is already making a POST request according to the source code:
The flow is the following:
A simple javascript makes an http request to KrakenD (without any Authentication header or token): http://localhost:3456/api/content/testapp/testschema
KrakenD gets the token from Squidex for a client which only has read permissions via client credentials flow (confidental), then makes a request to Squidex with the token, then returns the response from Squidex to the client.
Just to give you more context: Golang comes with oauth2 support, it has a built-in lib for it. You don’t need to download any extra dependency, you can import the golang.org/x/oauth2/clientcredentials package and just use it. If you would write now a golang app, which would have to interact with squidex as client, it would have trouble getting a token because of the built-in oauth2 client of golang. You would be forced to write your own implementation.