jitsu
jitsu copied to clipboard
Server should get oauth secrets from HTTP endpoint instead of configuration file
Problem
At the moment sources with OAuth enabled requires oauth secrets to be kept at jitsu server config file.
Example, for google analytics source following fields should be added to config file:
google_analytics:
client_id: •••••••••••••
client_secret: •••••••••
UI gets the list of fields that should not be editable with UI from /configurator/proxy/api/v1/sources/oauth_fields/google_analytics?project_id={project_id}
endpoint.
Since oauth secrets should be configured in oauth server two it creates a duplication. Besides, server should be restarted when on each configuration change
Solution
Server should take oauth secrets from oauth server (since it has all necessary data). Configuration could look like:
oauth_secrets: https://:<SECRETS TOKEN>@oauth.server/api/secrets
Endpoint (already implemented) returns data in following format:
[
{
"driver": "GOOGLE",
"name": "google_analytics",
"config": {
"client_id": "•••••••••••••",
"client_secret": "•••••••••"
}
}
]
After authdash server refactoring endpoint changed it's format to:
[
....
{
"id": "google_analytics",
"type": "GOOGLE",
"secrets": {
"clientId": "•••••••••••••",
"clientSecret": "•••••••••••••"
},
}
....
The biggest change is camelCase instead of snake_case for secrets key. To make it compatible with Jitsu naming convensions, we should automatically do camelCase → snake_case conversion for all keys inside secrets