new Regex(@"[A-Za-z0-9+/]+\.[A-Za-z0-9+/]+\.[A-Za-z0-9+/]+", RegexOptions.Compiled)
The above regex will not pass for API keys, which contain either dash or underline right next to the dot which separates individual parts of the JWT, despite such API keys being valid.
Repro steps
Get an API key and adjust it according to the description
Pass the API key to UsePreviewApi() method during client instantiation
See error
Expected behavior
The client should be instantiated properly.
Test environment
Tested on version 16.0.0, which uses the same validation regex as the latest (17.0.0)
Brief bug description
API keys in Kontent.ai are JWTs. As explained in JWT docs, individual parts are encoded as base64url. According to the specification, base64url can contain dashes (-) and underlines (_). SDK uses the following regex to validate API keys:
new Regex(@"[A-Za-z0-9+/]+\.[A-Za-z0-9+/]+\.[A-Za-z0-9+/]+", RegexOptions.Compiled)
The above regex will not pass for API keys, which contain either dash or underline right next to the dot which separates individual parts of the JWT, despite such API keys being valid.
Repro steps
Expected behavior
The client should be instantiated properly.
Test environment
Tested on version 16.0.0, which uses the same validation regex as the latest (17.0.0)