OAuth 2.0 access token flow
- Last Updated: May 13, 2025
- 1 minute read
- DataDirect Connectors
- JDBC
- GitHub 6.0
- Documentation
Note: To use OAuth 2.0
authentication, you must first register your application with GitHub. Refer to the GitHub
documentation for more information.
Typically, an OAuth 2.0 access flow is handled by the application. However, in some scenarios, you may need to secure an access token using external processes. In those instances, you can use the access token flow to access the service manually.
Note: Access tokens are permanent and
need not be replaced to maintain the session without interruption. Access tokens can be
reused continually, unless revoked by the user.
The following string includes the properties used to connect with the OAuth 2.0 access token flow.
jdbc:datadirect:github:ServerName=server_name;AuthenticationMethod=OAuth2;
AccessToken=access_token;[property=value[;...]];
where:
- server_name
- specifies the base URL of the GitHub instance to which you want to issue requests. For example, github.enterprise.com for enterprise accounts and api.github.com for cloud accounts.
- access_token
- specifies the access token required to authenticate to GitHub. This property allows you to set the access token manually.
- property=value
- specifies connection property settings. Multiple properties are separated by a semi-colon.
The following example connection string includes the properties required for connecting with the OAuth 2.0 access token flow.
Connection conn = DriverManager.getConnection
("jdbc:datadirect:github:ServerName=github.enterprise.com;
DefaultQueryOptions=(orgName=org_name;userName=user_name;
repoName=repo_name;projectId=project_Id;
columnId=column_Id;);AuthenticationMethod=OAuth2;
AccessToken=C3TQH9zjwek4CgJCU-4Mxb2D2LB3a-dNfpWYx;");
Note: The DefaultQueryOption
connection property is optional.