qwc-services / qwc-oidc-auth

QWC authentication service with OpenID Connect (OIDC)
MIT License
0 stars 4 forks source link

qwc-oidc-auth and qwc-data-service: can't adapt type 'dict' #2

Closed rsrg-zwiama closed 11 months ago

rsrg-zwiama commented 1 year ago

We use qwc services (qwc-docker as well as qwc-services on Kubernetes). We started with the db-auth-service for authorization and switched to the qwc-oidc-auth later. Now the field type for username doesn't match for the "edit_user_field" to automatically update the editing user.

ERROR in data_service: (psycopg2.ProgrammingError) can't adapt type 'dict'
...
[parameters: {'__val0': '12', '__val1': '4', '__val2': False, '__val3': '...', '__val4': {'username': 'zwiama', 'groups': ['verified']}, '__val5': '2023-11-06 10:57:26.675526', '__val6': False, 'geom': '{"coordinates": [[2534723.023262591, 1154148.493121253, 0]], "type": "MultiPoint"}', 'id': 277}]

I think the matter is the different definition of identity. For qwc-oidc-auth the identity is defined as:

identity = {'username': username, 'groups': groups}
app.logger.info(identity)
# Create the tokens we will be sending back to the user
access_token = create_access_token(identity)

For qwc-db-auth the identity is defined as:

identity = {
            'username': user.name
        }
...
 access_token = create_access_token(identity=identity)

How do I configure the qwc-oidc-auth to work with qwc-data-service (only username for identity)?

rsrg-zwiama commented 11 months ago

hi, do you have any update on that? Or should i move it to data-service repo? Thanks, Amanda

manisandro commented 11 months ago

This needs to be addressed in the data-service, yes please move the issues there.

rsrg-zwiama commented 11 months ago

I opened new issue in data service : https://github.com/qwc-services/qwc-data-service/issues/27