stupid-yu commented on issue #20546:
URL: https://github.com/apache/superset/issues/20546#issuecomment-1177294237

   hello, I have the same problem when using `curl` to create database.
   
   ```bash
   [root@superset]# token=$(curl -X 'POST' \
     'http://'${HOSTNAME}':'${PORT}'/api/v1/security/login' \
     -H 'accept: */*' \
     -H 'Content-Type: application/json' \
     -d '{
     "username": "admin",
     "password": "admin",
     "refresh": true,
     "provider": "db"
   }')
   
   [root@superset]# function parse_json { echo "${1//\"/}" | sed 
"s/.*$2:\([^,}]*\).*/\1/" ; }
   
   [root@superset]# csrf=$(curl -X 'GET' 
'http://'${HOSTNAME}':'${PORT}'/api/v1/security/csrf_token/' -H 'Authorization: 
Bearer '$(parse_json $token "access_token")'')
   
   [root@superset]# curl -vvvv -X 'POST' 
'http://'${HOSTNAME}':'${PORT}'/api/v1/database/' -H 'Authorization: Bearer 
'$(parse_json $token "access_en: '$(parse_json $csrf "result")'' -H 'accept: 
*/*' -H 'Content-Type: application/json' -d '{
   "database_name": "kyuubi-jdbc",
   "sqlalchemy_uri": "hive://bcdp@dwh-htwsxrv9-kyuubi-kyuubi",
   "expose_in_sqllab": true,
   "allow_ctas": true,
   "allow_cvas": true,
   "allow_dml": true,
   "allow_multi_schema_metadata_fetch": true
   }'
   * About to connect() to dwh-htwsxrv9-kyuubi-superset-dc959bbbd-lhkcf port 
58093 (#0)
   *   Trying 192.168.11.173...
   * Connected to dwh-htwsxrv9-kyuubi-superset-dc959bbbd-lhkcf (192.168.11.173) 
port 58093 (#0)
   > POST /api/v1/database/ HTTP/1.1
   > User-Agent: curl/7.29.0
   > Host: dwh-htwsxrv9-kyuubi-superset-dc959bbbd-lhkcf:58093
   > Authorization: Bearer 
eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpYXQiOjE2NTcxODI2MTcsIm5iZiI6MTY1NzE4MjYxNywianRpIjoiMzYxMjA4YmEtMThjZC00MDY0LTgxOTQtNjdiZjI3ZmY1ZjI2IiwiZXhwIjoxNjU3MTgzNTEJlc2giOnRydWUsInR5cGUiOiJhY2Nlc3MifQ.a7sFispKsyUD3FDo47HuuCtq9jP7xpWy3ZaeI1bVpuc
   > X-CSRFToken: 
ImY2ZmUxNDIzNGQ2YTUwYjI2NDg3ZDc0YjRjOGUxZGMwMDAzODA3Zjgi.YsaZsQ.SrP1_NXVfnSZ6uW16V25vPE7yqo
   > accept: */*
   > Content-Type: application/json
   > Content-Length: 222
   > 
   * upload completely sent off: 222 out of 222 bytes
   * HTTP 1.0, assume close after body
   < HTTP/1.0 400 BAD REQUEST
   < Content-Type: text/html; charset=utf-8
   < Content-Length: 150
   < Server: Werkzeug/1.0.1 Python/3.7.10
   < Date: Thu, 07 Jul 2022 08:33:01 GMT
   < 
   <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
   <title>400 Bad Request</title>
   <h1>Bad Request</h1>
   <p>The CSRF session token is missing.</p>
   * Closing connection 0
   ```
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to