Superset API IMPORT throw into Login Redirect page #30713
Unanswered
illaaa
asked this question in
Q&A / Help
Replies: 1 comment
-
Hey there, @illaaa! I'm here to help you with any bugs, questions, or contributions you have in mind. Let's squash those bugs together! 😄 There are similar issues reported regarding the Superset API redirecting to the login page when trying to import a dashboard. Here are some key points and a potential solution:
Here's a brief example of how you might adjust your script to handle cookies: # Login and get access token
LOGIN_RESPONSE=$(curl -s -X POST "$SUPSERSET_URL/api/v1/security/login" \
-H "Content-Type: application/json" \
-d '{"username": "'"$USERNAME"'", "password": "'"$PASSWORD"'", "provider": "db", "refresh": "True"}')
ACCESS_TOKEN=$(echo $LOGIN_RESPONSE | jq -r '.access_token')
# Get CSRF token with cookies
curl -c cookies.txt -H "Authorization: Bearer $ACCESS_TOKEN" -L "$SUPSERSET_URL/api/v1/security/csrf_token/" > csrf_token.json
CSRF_TOKEN=$(jq -r '.result' csrf_token.json)
# Import dashboard using cookies
IMPORT_RESPONSE=$(curl -s -X POST "$SUPSERSET_URL/api/v1/dashboard/import/" \
-b cookies.txt \
-H "Authorization: Bearer $ACCESS_TOKEN" \
-H "X-CSRFToken: $CSRF_TOKEN" \
-H "Accept: application/json" \
-F "formData=@$ZIP_FILE_PATH" \
-F "passwords= $PASSWORDS" \
-F "ssh_tunnel_passwords={}" \
-F "ssh_tunnel_private_keys={}" \
-F "ssh_tunnel_private_key_passwords={}" \
-F "overwrite=true") This approach ensures that session cookies are maintained across requests, which might resolve the redirection issue. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hi guys,
I'm trying to import a dashboard through the API but in the result I get a redirection to login page.
Superset version is 4.0.0
If I execute same requests from Postman, everything works fine.
Here is the requests I send from bash:
Also checked these comments for the same problem. Adding "Cookie" or "Referer" does not help.
#22407 (comment)
#16030 (comment)
#16030 (comment)
Would be grateful for any help and suggestions
Beta Was this translation helpful? Give feedback.
All reactions