Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

authorization fails with com.microsoft.sqlserver.jdbc.SQLServerException on SQL Server 2019 #1174

Closed
vincenzo-scia opened this issue Apr 19, 2023 · 1 comment
Assignees
Labels
status: duplicate A duplicate of another issue

Comments

@vincenzo-scia
Copy link

vincenzo-scia commented Apr 19, 2023

Describe the bug
Cannot authorize on existing registered client with SQL Server 2019.

org.springframework.jdbc.UncategorizedSQLException: PreparedStatementCallback; uncategorized SQLException for SQL [INSERT INTO oauth2_authorization (id, registered_client_id, principal_name, authorization_grant_type, authorized_scopes, attributes, state, authorization_code_value, authorization_code_issued_at, authorization_code_expires_at, authorization_code_metadata, access_token_value, access_token_issued_at, access_token_expires_at, access_token_metadata, access_token_type, access_token_scopes, oidc_id_token_value, oidc_id_token_issued_at, oidc_id_token_expires_at, oidc_id_token_metadata, refresh_token_value, refresh_token_issued_at, refresh_token_expires_at, refresh_token_metadata) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)]; SQL state [null]; error code [0]; The string is not in a valid hex format.

Caused by: com.microsoft.sqlserver.jdbc.SQLServerException: The string is not in a valid hex format.

is thrown on insertion.

To Reproduce
Attempt to authorize via existing registered client, example url: https://my.domain/my-application/oauth2/authorize?client_id=my-client&response_type=code&redirect_uri=https://my.domain/my-application/callback&scope=read write

Expected behavior
Should successfully authorize

What seems to be happening
It seems that spring-authorization-server strictly requires a datatype BLOB for some oauth2_authorization table columns (e.g. attributes, authorization_code_metadata) but the datatype BLOB seems not to be available on SQL Server 2019. Which datatype should be used on SQL Server 2019? In the attempt described above, VARBINARY is being used instead of BLOB.

@vincenzo-scia vincenzo-scia added the type: bug A general bug label Apr 19, 2023
@jgrandja
Copy link
Collaborator

@vincenzo-scia Closing this as a duplicate of gh-550.

For additional details, please see this comment.

@jgrandja jgrandja self-assigned this Apr 19, 2023
@jgrandja jgrandja added status: duplicate A duplicate of another issue and removed type: bug A general bug labels Apr 19, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status: duplicate A duplicate of another issue
Projects
None yet
Development

No branches or pull requests

2 participants