Skip to content

Fix OAuth profile type option key mismatch - #866

Merged
littlegrasscao merged 1 commit into
mainfrom
sucao/fix-oauth
Mar 26, 2026
Merged

littlegrasscao merged 1 commit into
mainfrom
sucao/fix-oauth

Conversation

@littlegrasscao

@littlegrasscao littlegrasscao commented Mar 24, 2026 •

Copy link
Copy Markdown
Collaborator

The Spark option key for profile type was shareCredentialsType, but the JSON deserializer in DeltaSharingProfileDeserializer reads the type field: https://github.com/delta-io/delta-sharing/blob/main/client/src/main/scala/io/delta/sharing/client/DeltaSharingProfileProvider.scala#L98

This caused OAuth profiles set via Spark options to silently fall back to bearer_token, failing with "bearer_token only supports version 1".

Rename the option from shareCredentialsType to type so the key matches the JSON field name used by .share profile files and the deserializer.

The Spark option key for profile type was `shareCredentialsType`, but the
JSON deserializer in DeltaSharingProfileDeserializer reads the `type` field.
This caused OAuth profiles set via Spark options to silently fall back to
bearer_token, failing with "bearer_token only supports version 1".

Rename the option from `shareCredentialsType` to `type` so the key matches
the JSON field name used by .share profile files and the deserializer.

val PROFILE_SHARE_CREDENTIALS_VERSION = "shareCredentialsVersion"
val PROFILE_TYPE = "shareCredentialsType"
val PROFILE_TYPE = "type"

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

remind me why shareCredentialsType doesn't work?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

then the question becomes: do we have testing cover the while workflow?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My new tests in this PR should cover the deserialize path.

But I don't think we have e2e test for OAuth sharing, as OAuth sharing is O2D only. Our server doesn't support OAuth.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If we were designing this from scratch without type support in the share profile, I would prefer shareCredentialsType, since type is a bit vague about what it refers to. However, it’s too late to make that change now. To keep things consistent, I think using type at this point is the right move.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the other options is to add more logic for supporting shareCredentialsType in https://github.com/delta-io/delta-sharing/blob/main/client/src/main/scala/io/delta/sharing/client/DeltaSharingProfileProvider.scala#L98
but then it means spark options will be diverging from the options in the share profile file.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, we probably want to follow the same pattern. Using "type" is ok as we understand it's within profile scope.

@moderakh moderakh left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@littlegrasscao
littlegrasscao merged commit 2951db2 into main Mar 26, 2026
5 of 7 checks passed
@littlegrasscao
littlegrasscao deleted the sucao/fix-oauth branch April 2, 2026 01:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants