Authentication to an API
Hi,
I would like for users to use credentials to use the features of an API via a plugin on Dataiku. I understand that I can use the basic credentials parameter, but I am not quite sure on how it actually works. It would be great if I can potentially see an example.
Note: I added the credentials request param with basic authentication, but for whatever reason could not see the username/password options in the profile settings.
Any help would be greatly appreciated.
Answers
-
Hi Vishet,
Are you looking for per-user credentials (i.e. each user employs a personal set of credentials to interact with the API) or per-group credentials (i.e. the use of a set of API credentials is granted to a DSS group)?
In either case, my initial suggestion would be to see if using a "parameter set" plugin component meets your needs. In short, the process would be:
- Add a "parameter set" components to your plugin and declare the type of credentials it can hold ("CREDENTIAL_REQUEST" for per-user OAuth2 or username/password, and "PASSWORD" for per-group passwords).
- Add the "parameter set" as a "PRESET" to the plugin component which needs to use the credentials (i.e. Recipe, Data Connector, etc.)
- Before using the plugin, enter the credentials:
- Per-user credentials: an admin must create at least one instance of the preset in the plugin settings, and then each user must enter their credentials in the "Credentials" tab of their user profile
- Per-group credentials: admins must administer plugin credentials from the plugin settings.
I know that this topic can initially seem complex, and so it might help to take a look at the source code of our Salesforce plugin as an example: https://github.com/dataiku/dss-plugin-salesforce
You'll see that under the "parameter-sets" folder, the plugin has two parameter sets: oauth-credentials and salesforce-login. The oauth-credentials provides the ability to enter per-user credentials via OAuth2, while the salesforce-login either allows to set per-groups permissions via username/password.
Hopefully this information helps you get started, although please feel free to reach out if you have any further questions.
Best of luck!
Ned