Skip to content

Send scope in client credentials token request - #45

Open
dbekasow-dmi wants to merge 1 commit into
trinodb:mainfrom
dbekasow-dmi:main
Open

dbekasow-dmi wants to merge 1 commit into
trinodb:mainfrom
dbekasow-dmi:main

Conversation

@dbekasow-dmi

Copy link
Copy Markdown

Problem:
refreshClientCredAuth url-encodes the configured scope but never writes it to the POST body. Entra rejects that with AADSTS90014. The empty token that comes back reaches parseAccessToken, which indexes jwtComponents[1] on an empty vector — the process dies with an access violation inside SQLExecDirect.

Changes:

  • Append scope to the token request
  • Return an empty object from parseAccessToken for malformed tokens
  • Throw when the provider returns no token, so callers get SQL_ERROR instead of a crash

Tested: Trino 483 with Entra ID, Windows x64. Driver now logs Client cred auth completed successfully.

@cla-bot

cla-bot Bot commented Sep 9, 2026

Copy link
Copy Markdown

Thank you for your pull request and welcome to the Trino community. We require contributors to sign our Contributor License Agreement, and we don't seem to have you on file. Continue to work with us on the review and improvements in this PR, and submit the signed CLA to cla@trino.io. Photos, scans, or digitally-signed PDF files are all suitable. Processing may take a few days. The CLA needs to be on file before we merge your changes. For more information, see https://github.com/trinodb/cla

@rileymcdowell

Copy link
Copy Markdown
Contributor

@dbekasow-dmi Thank you for your contribution! This is pretty close to what we need for it to be mergeable. Are you willing to sign the Contributor License Agreement for the Trino Software Foundation? If so, I can probably make a small tweak and get this feature merged for you. Whether you're willing or not, please let me know. I think you found a bug in how scopes are handled between various auth flows and I would like to get it fixed.

@rileymcdowell

Copy link
Copy Markdown
Contributor

This is partially fixed by #47 and released in https://github.com/trinodb/trino-odbc/releases/tag/v0.0.8.

We need to figure out how to handle JWS (Javascript Web Signature) which are encrypted and are not formatted into header, payload, and signature like a typical JWT.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

2 participants