Configuring a Custom Connector to Use OAuth
If you are using any browser-based authentication, for example, OAuth, while connecting to your data source with a custom connector, you need to configure the JDBC configuration file to run as the logged-in user and not as System.
You need to do this only once: upon your first session with the custom connector. This will affect all connections that use the Generic JDBC Connector.
Depending on your driver, you can do this in one of these two methods:
- For non-CData drivers, use Sisense to generate the OAuth file.
- For CData drivers, use the driver .jar file of the CData driver to generate the OAuth file.
To configure the JDBC configuration file for non-CData drivers:
-
Navigate to the description.json file in
C:\Program Files\Sisense\DataConnectors\JVMContainer\Connectors\GenericJDBC\
-
Change the value of "startAsUser" from False to True.
This value uses the credentials of the user trying to authenticate instead of the Sisense system user. -
Restart the Sisense.JVMConnectorsContainer service.
-
Access Sisense web application via localhost ( http://localhost:8081/ by default, https://localhost for secure connections).
-
Open Sisense and, in the Connection Wizard, add data using the Generic JDBC connector:
In the Connection String field, enter<driver name>:InitiateOAuth=GETANDREFRESH;
Populate the other fields as required. -
Find the generated OAuth file with the tokens in the directory
%AppData%\Roaming\CData\<Provider Name> \
-
Copy this .txt file to a different location (for example:
C:/Sisense_OAuth_files
). -
Return to
C:\ProgramFiles\Sisense\DataConnectors\JVMContainer\Connectors\GenericJDBC\description.json
and change the value of "startAsUser" back to False. -
Restart the Sisense.JVMConnectorsContainer service.
Open Sisense and go to the Connection Wizard. Add the following parameters at the end of your connection string:InitiateOAuth=GETANDREFRESH;OAuthSettingsLocation=<Path_To_Copied_File>/<Copied_File.txt>;
Populate the other fields as required.
To configure the JDBC configuration file for CData driver:
-
Double-click the .jar file located in the
C:\Program Files\CData\CData JDBC Driver for <DriverName>\lib
.The Connection String Builder opens.
-
Change the IntitiateOAuth parameter to
GETANDREFRESH
and test the connection.The web page where you can log in to the data source will open in a new browser tab.
-
Log in through the web page. This creates an OAuth file under
%AppData%\Roaming\CData\<Provider Name> \
. -
Copy this .txt file to a different location (for example:
C:/Sisense_OAuth_files
). -
Open Sisense and go to the Connection Wizard. Add the following parameters at the end of your connection string:
OAuthSettingsLocation=Path_To_Copied_File.txt/<Copied_File.txt>;
Fill in the other fields as required.