[GH-ISSUE #822] How to use gql to login cloudbeaver ? #206

Closed
opened 2026-03-07 20:46:11 +03:00 by kerem · 8 comments
Owner

Originally created by @itman2022 on GitHub (May 11, 2022).
Original GitHub issue: https://github.com/dbeaver/cloudbeaver/issues/822

please help me , How to use gql to login ? I haven't used gql yet,thanks very much !!!

1.the query is :

query authLogin($provider: ID!, $credentials: Object!, $linkUser: Boolean, $customIncludeOriginDetails: Boolean!) {
  authToken: authLogin(
    provider: $provider
    credentials: $credentials
    linkUser: $linkUser
  ) {
    ...AuthToken
  }
}
    
fragment AuthToken on UserAuthToken {
  authProvider
  authConfiguration
  loginTime
  message
  origin {
    ...ObjectOriginInfo
  }
}
    
fragment ObjectOriginInfo on ObjectOrigin {
  type
  subType
  displayName
  icon
  details @include(if: $customIncludeOriginDetails) {
    id
    displayName
    description
    category
    dataType
    defaultValue
    validValues
    value
    length
    features
    order
  }
}

2.the variables is :

{
  "provider": "local",
  "credentials": {
    "user": "cbadmin",
    "password": "E10ADC3949BA59ABBE56E057F20F883E"
  },
  "linkUser": true,
  "customIncludeOriginDetails": true
}

login_gql

Originally created by @itman2022 on GitHub (May 11, 2022). Original GitHub issue: https://github.com/dbeaver/cloudbeaver/issues/822 please help me , How to use gql to login ? I haven't used gql yet,thanks very much !!! 1.the query is : ``` query authLogin($provider: ID!, $credentials: Object!, $linkUser: Boolean, $customIncludeOriginDetails: Boolean!) { authToken: authLogin( provider: $provider credentials: $credentials linkUser: $linkUser ) { ...AuthToken } } fragment AuthToken on UserAuthToken { authProvider authConfiguration loginTime message origin { ...ObjectOriginInfo } } fragment ObjectOriginInfo on ObjectOrigin { type subType displayName icon details @include(if: $customIncludeOriginDetails) { id displayName description category dataType defaultValue validValues value length features order } } ``` 2.the variables is : ``` { "provider": "local", "credentials": { "user": "cbadmin", "password": "E10ADC3949BA59ABBE56E057F20F883E" }, "linkUser": true, "customIncludeOriginDetails": true } ``` ![login_gql](https://user-images.githubusercontent.com/49448987/167903213-c4a1d90d-9912-47b0-984d-f74480513e73.jpg)
kerem 2026-03-07 20:46:11 +03:00
Author
Owner

@Wroud commented on GitHub (May 12, 2022):

Please try:
Query:

query authLogin($provider: ID!, $credentials: Object!, $linkUser: Boolean) {
  authToken: authLogin(
    provider: $provider
    credentials: $credentials
    linkUser: $linkUser
  ) {
    authProvider
  }
}

variables:

{
  "provider": "local",
  "credentials": {
    "user": "cbadmin",
    "password": "E10ADC3949BA59ABBE56E057F20F883E"
  },
  "linkUser": true
}
<!-- gh-comment-id:1124957822 --> @Wroud commented on GitHub (May 12, 2022): Please try: Query: ``` query authLogin($provider: ID!, $credentials: Object!, $linkUser: Boolean) { authToken: authLogin( provider: $provider credentials: $credentials linkUser: $linkUser ) { authProvider } } ``` variables: ``` { "provider": "local", "credentials": { "user": "cbadmin", "password": "E10ADC3949BA59ABBE56E057F20F883E" }, "linkUser": true } ```
Author
Owner

@serge-rider commented on GitHub (May 13, 2022):

Note: parameter "password" must be a MD5 hash of original user password.

<!-- gh-comment-id:1125825598 --> @serge-rider commented on GitHub (May 13, 2022): Note: parameter "password" must be a MD5 hash of original user password.
Author
Owner

@kseniiaguzeeva commented on GitHub (Jun 14, 2022):

I have noticed that you have not updated your ticket for a long time. If you wish to reopen this ticket, please feel free to contact me.

<!-- gh-comment-id:1154873034 --> @kseniiaguzeeva commented on GitHub (Jun 14, 2022): I have noticed that you have not updated your ticket for a long time. If you wish to reopen this ticket, please feel free to contact me.
Author
Owner

@natamongkol commented on GitHub (Mar 16, 2023):

Please try: Query:

query authLogin($provider: ID!, $credentials: Object!, $linkUser: Boolean) {
  authToken: authLogin(
    provider: $provider
    credentials: $credentials
    linkUser: $linkUser
  ) {
    authProvider
  }
}

variables:

{
  "provider": "local",
  "credentials": {
    "user": "cbadmin",
    "password": "E10ADC3949BA59ABBE56E057F20F883E"
  },
  "linkUser": true
}

I try it but not work for me it's error

{ "errors": [ { "message": "Validation error of type FieldUndefined: Field 'authProvider' in type 'AuthInfo' is undefined @ 'authLogin/authProvider'", "locations": [ { "line": 8, "column": 5 } ] } ] }

<!-- gh-comment-id:1471532473 --> @natamongkol commented on GitHub (Mar 16, 2023): > Please try: Query: > > ``` > query authLogin($provider: ID!, $credentials: Object!, $linkUser: Boolean) { > authToken: authLogin( > provider: $provider > credentials: $credentials > linkUser: $linkUser > ) { > authProvider > } > } > ``` > > variables: > > ``` > { > "provider": "local", > "credentials": { > "user": "cbadmin", > "password": "E10ADC3949BA59ABBE56E057F20F883E" > }, > "linkUser": true > } > ``` I try it but not work for me it's error `{ "errors": [ { "message": "Validation error of type FieldUndefined: Field 'authProvider' in type 'AuthInfo' is undefined @ 'authLogin/authProvider'", "locations": [ { "line": 8, "column": 5 } ] } ] }`
Author
Owner

@DanHartman commented on GitHub (Apr 11, 2023):

I'm also attempting to do this. I've used the graphql queries and fragments here in the repo. I'm receiving an error of Invalid user credentials. I'm using the CB_ADMIN creds set using environment variables in the container.

  • Should the admin creds work?
  • Can one authenticate in this manner?
  • If the above two are "yes," can you help me understand what I've missed?

Query

query authLogin($provider: ID!, $configuration: ID, $credentials: Object, $linkUser: Boolean, $customIncludeOriginDetails: Boolean!) {
  authInfo: authLogin(provider: $provider, configuration: $configuration, credentials: $credentials, linkUser: $linkUser) {
    redirectLink
    authId
    authStatus
    userTokens {
      ...AuthToken
    }
  }
}

fragment AuthToken on UserAuthToken {
  authProvider
  authConfiguration
  loginTime
  message
  origin {
    ...ObjectOriginInfo
  }
}

fragment ObjectOriginInfo on ObjectOrigin {
  type
  subType
  displayName
  icon
  details @include(if: $customIncludeOriginDetails) {
    id
    displayName
    description
    category
    dataType
    defaultValue
    validValues
    value
    length
    features
    order
  }
}

Variables

{
  "provider": "local",
  "credentials": {
    "user": "${CB_ADMIN_NAME}",
    "password": "$(printf "${CB_ADMIN_PASSWORD}" | md5sum | awk '{print $1}')"
  },
  "linkUser": true,
  "customIncludeOriginDetails": true
}

Output

{
  "errors": [
    {
      "message": "User authentication failed:\nAuthentication failed: Invalid user credentials",
      "locations": [
        {
          "line": 3,
          "column": 3
        }
      ],
      "path": [
        "authInfo"
      ],
      "extensions": {
        "exceptionClass": "org.jkiss.dbeaver.DBException",
        "stackTrace": "org.jkiss.dbeaver.DBException: Authentication failed: Invalid user credentials\n\tat io.cloudbeaver.model.session.WebSessionAuthProcessor.authenticateSession(WebSessionAuthProcessor.java:69)\n\tat io.cloudbeaver.service.auth.impl.WebServiceAuthImpl.authLogin(WebServiceAuthImpl.java:97)\n\tat jdk.internal.reflect.GeneratedMethodAccessor27.invoke(Unknown Source)\n\tat java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)\n\tat java.base/java.lang.reflect.Method.invoke(Unknown Source)"
      }
    }
  ],
  "data": null
}
<!-- gh-comment-id:1502737903 --> @DanHartman commented on GitHub (Apr 11, 2023): I'm also attempting to do this. I've used the graphql queries and fragments here in the repo. I'm receiving an error of `Invalid user credentials`. I'm using the CB_ADMIN creds set using environment variables in the container. * Should the admin creds work? * Can one authenticate in this manner? * If the above two are "yes," can you help me understand what I've missed? ### Query ```gql query authLogin($provider: ID!, $configuration: ID, $credentials: Object, $linkUser: Boolean, $customIncludeOriginDetails: Boolean!) { authInfo: authLogin(provider: $provider, configuration: $configuration, credentials: $credentials, linkUser: $linkUser) { redirectLink authId authStatus userTokens { ...AuthToken } } } fragment AuthToken on UserAuthToken { authProvider authConfiguration loginTime message origin { ...ObjectOriginInfo } } fragment ObjectOriginInfo on ObjectOrigin { type subType displayName icon details @include(if: $customIncludeOriginDetails) { id displayName description category dataType defaultValue validValues value length features order } } ``` ### Variables ```bash { "provider": "local", "credentials": { "user": "${CB_ADMIN_NAME}", "password": "$(printf "${CB_ADMIN_PASSWORD}" | md5sum | awk '{print $1}')" }, "linkUser": true, "customIncludeOriginDetails": true } ``` ### Output ```json { "errors": [ { "message": "User authentication failed:\nAuthentication failed: Invalid user credentials", "locations": [ { "line": 3, "column": 3 } ], "path": [ "authInfo" ], "extensions": { "exceptionClass": "org.jkiss.dbeaver.DBException", "stackTrace": "org.jkiss.dbeaver.DBException: Authentication failed: Invalid user credentials\n\tat io.cloudbeaver.model.session.WebSessionAuthProcessor.authenticateSession(WebSessionAuthProcessor.java:69)\n\tat io.cloudbeaver.service.auth.impl.WebServiceAuthImpl.authLogin(WebServiceAuthImpl.java:97)\n\tat jdk.internal.reflect.GeneratedMethodAccessor27.invoke(Unknown Source)\n\tat java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)\n\tat java.base/java.lang.reflect.Method.invoke(Unknown Source)" } } ], "data": null } ```
Author
Owner

@DanHartman commented on GitHub (Apr 11, 2023):

I have noticed that you have not updated your ticket for a long time. If you wish to reopen this ticket, please feel free to contact me.

@kseniiaguzeeva I was up too late. I just noticed this was a closed ticket. Can we re-open this? Or would it be preferable to start a new issue?

<!-- gh-comment-id:1503385120 --> @DanHartman commented on GitHub (Apr 11, 2023): > I have noticed that you have not updated your ticket for a long time. If you wish to reopen this ticket, please feel free to contact me. @kseniiaguzeeva I was up too late. I just noticed this was a closed ticket. Can we re-open this? Or would it be preferable to start a new issue?
Author
Owner

@DanHartman commented on GitHub (Apr 13, 2023):

@Wroud Can you let me know if this issue can be re-opened, or if I should start a new one?

<!-- gh-comment-id:1507094711 --> @DanHartman commented on GitHub (Apr 13, 2023): @Wroud Can you let me know if this issue can be re-opened, or if I should start a new one?
Author
Owner

@DanHartman commented on GitHub (Apr 14, 2023):

Nevermind! I finally caught that the hashed password was all upper case!

<!-- gh-comment-id:1508650446 --> @DanHartman commented on GitHub (Apr 14, 2023): Nevermind! I finally caught that the hashed password was all upper case!
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/cloudbeaver#206
No description provided.