karmada-io / dashboard

Web UI for Karmada
Apache License 2.0
49 stars 42 forks source link

How can I login into the dashboard ui? #88

Closed shauvet closed 2 months ago

shauvet commented 2 months ago

Please provide an in-depth description of the question you have: I want to participate in frontend development and have followed the instructions in this document: https://github.com/karmada-io/dashboard/blob/main/DEVELOPMENT.md to successfully configure the environment. However, when I try to log in locally, I need to enter a token. After entering the token, I encounter the following error message:

curl 'http://localhost:5173/api/v1/login' \
  -H 'Accept: application/json, text/plain, */*' \
  -H 'Accept-Language: zh-CN,zh;q=0.9,ja;q=0.8,en;q=0.7' \
  -H 'Authorization: Bearer eyJhbGciOiJSUzI1NiIsImtpZCI6IjE3SjNsSk9wLTBUUld6SENxM2c4c0JNcnZGX1JPZno3blpKNGx0UFRDVzgifQ.eyJhdWQiOlsiaHR0cHM6Ly9rdWJlcm5ldGVzLmRlZmF1bHQuc3ZjLmNsdXN0ZXIubG9jYWwiXSwiZXhwIjoxNzIzMTI3MzUxLCJpYXQiOjE3MjMxMjM3NTEsImlzcyI6Imh0dHBzOi8va3ViZXJuZXRlcy5kZWZhdWx0LnN2Yy5jbHVzdGVyLmxvY2FsIiwia3ViZXJuZXRlcy5pbyI6eyJuYW1lc3BhY2UiOiJrYXJtYWRhLXN5c3RlbSIsInNlcnZpY2VhY2NvdW50Ijp7Im5hbWUiOiJrYXJtYWRhLWRhc2hib2FyZCIsInVpZCI6ImUyMjUyZjkxLTc0NTktNDc0OS05MDA4LThjMjFhY2ZjNDk1MiJ9fSwibmJmIjoxNzIzMTIzNzUxLCJzdWIiOiJzeXN0ZW06c2VydmljZWFjY291bnQ6a2FybWFkYS1zeXN0ZW06a2FybWFkYS1kYXNoYm9hcmQifQ.gLYt3RhuM3e7YYsYIH2sViXNsVOdD2YlP9dwx2UGiiLp6CRRyJphpAtJEBuCCufkO9yUOEmR60H1hGmrvmFfl8iiZKFowwlX213jFhhmimazMy06aBucqOGKcVzn8i9buv0AnZdHdcPSSAIRGydMhOng8RGTwwPRCrYwc9fqb8VZAXjskD6FYVR1nJNh4jjXDw9LjDxIhD_RcUdSp-dO_6dWT-BSCUj-FFyePqLPKuRSpIqCUgW12Wz-DfUdVR2tCoigHTKy1ZsiLPeYYMChL7QZa15yrNyuM0MxBGl--j45ggd3BSaeBhRGri85_G0OOmDc1SoGD16xxVLhzsmfmBCNtmk7uHh09r4g8K_Sj-Yg-UQLSd8lhjzaEu74-_5fxTMznfxJVa6jwc0meh_pdCCEVpi4lrWxCYCPnMl1grRnIaJ1f7BPbX20qAa5j6_2w1z2akZNCZDaryX4nVaMJnJYivHEllASQhV3FGQeVrhqlOchDzoWR4qlGwMxhYNR' \
  -H 'Cache-Control: no-cache' \
  -H 'Connection: keep-alive' \
  -H 'Content-Type: application/json' \
  -H 'Cookie: __stripe_mid=a4dae767-dfe4-4c22-b3a4-78ce62c01f5b7207aa' \
  -H 'Origin: http://localhost:5173' \
  -H 'Pragma: no-cache' \
  -H 'Referer: http://localhost:5173/login' \
  -H 'Sec-Fetch-Dest: empty' \
  -H 'Sec-Fetch-Mode: cors' \
  -H 'Sec-Fetch-Site: same-origin' \
  -H 'User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/127.0.0.0 Safari/537.36' \
  -H 'sec-ch-ua: "Not)A;Brand";v="99", "Google Chrome";v="127", "Chromium";v="127"' \
  -H 'sec-ch-ua-mobile: ?0' \
  -H 'sec-ch-ua-platform: "macOS"' \
  --data-raw '{"token":"eyJhbGciOiJSUzI1NiIsImtpZCI6IjE3SjNsSk9wLTBUUld6SENxM2c4c0JNcnZGX1JPZno3blpKNGx0UFRDVzgifQ.eyJhdWQiOlsiaHR0cHM6Ly9rdWJlcm5ldGVzLmRlZmF1bHQuc3ZjLmNsdXN0ZXIubG9jYWwiXSwiZXhwIjoxNzIzMTI3MzUxLCJpYXQiOjE3MjMxMjM3NTEsImlzcyI6Imh0dHBzOi8va3ViZXJuZXRlcy5kZWZhdWx0LnN2Yy5jbHVzdGVyLmxvY2FsIiwia3ViZXJuZXRlcy5pbyI6eyJuYW1lc3BhY2UiOiJrYXJtYWRhLXN5c3RlbSIsInNlcnZpY2VhY2NvdW50Ijp7Im5hbWUiOiJrYXJtYWRhLWRhc2hib2FyZCIsInVpZCI6ImUyMjUyZjkxLTc0NTktNDc0OS05MDA4LThjMjFhY2ZjNDk1MiJ9fSwibmJmIjoxNzIzMTIzNzUxLCJzdWIiOiJzeXN0ZW06c2VydmljZWFjY291bnQ6a2FybWFkYS1zeXN0ZW06a2FybWFkYS1kYXNoYm9hcmQifQ.gLYt3RhuM3e7YYsYIH2sViXNsVOdD2YlP9dwx2UGiiLp6CRRyJphpAtJEBuCCufkO9yUOEmR60H1hGmrvmFfl8iiZKFowwlX213jFhhmimazMy06aBucqOGKcVzn8i9buv0AnZdHdcPSSAIRGydMhOng8RGTwwPRCrYwc9fqb8VZAXjskD6FYVR1nJNh4jjXDw9LjDxIhD_RcUdSp-dO_6dWT-BSCUj-FFyePqLPKuRSpIqCUgW12Wz-DfUdVR2tCoigHTKy1ZsiLPeYYMChL7QZa15yrNyuM0MxBGl--j45ggd3BSaeBhRGri85_G0OOmDc1SoGD16xxVLhzsmfmBCNtmk7uHh09r4g8K_Sj-Yg-UQLSd8lhjzaEu74-_5fxTMznfxJVa6jwc0meh_pdCCEVpi4lrWxCYCPnMl1grRnIaJ1f7BPbX20qAa5j6_2w1z2akZNCZDaryX4nVaMJnJYivHEllASQhV3FGQeVrhqlOchDzoWR4qlGwMxhYNR"}'
{"code":500,"message":"MSG_LOGIN_UNAUTHORIZED_ERROR","data":null}

What do you think about this question?: Could it be that I need to request permissions or perform some other actions, or is there something wrong with my configuration? Environment:

warjiang commented 2 months ago

@shauvet how to get the jwt token, when generating jwt token, you should specify with right kubeconfig and right context

You can follow the doc 👉🏻 https://github.com/karmada-io/dashboard/blob/main/docs/user-guide.md#installation-of-karmada-dashboard

image

try to generate another jwt token and retry the login api. If any problem, feel free to ask me~

shauvet commented 2 months ago

solved