Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can't get to loading page for voter frontend #218

Open
Kevin-Mok opened this issue Mar 7, 2023 · 1 comment
Open

Can't get to loading page for voter frontend #218

Kevin-Mok opened this issue Mar 7, 2023 · 1 comment

Comments

@Kevin-Mok
Copy link

Kevin-Mok commented Mar 7, 2023

I started the demo using ./docker-prebuilt-up.sh and got to the voting stage. But when I use the voter frontend, I can't seem to login and get to the loading page. I'm using the default credentials found in identity-provider-backend/src/database/identities like alex:alex.

When I try to login, it flashes "Currently no vote ongoing." from the NotOpen page. This made me think that the switch for votingState was going to the default case:

default:
return <NotOpen />

But when I checked state page for the access provider at http://172.1.1.42:4002/state, I see {"state":"VOTING","address":"0x5F3DBa5e45909D1bf126aA0aF0601B1a369dbFD7"}. This made me realize it should be going into the VOTING case and is probably going into the !state.authenticate branch where it's returning me to the login page:

case VotingState.VOTING:
if (!state.authenticated) {
return <LoginPage />

So then, this made me think the credentials were invalid or not registered. But, I tried running:

curl -X POST \
  http://172.1.1.43:4003/registerVoters \
  -H 'Content-Type: application/json' \
  -d '{
    "voters": [
        "9980280d-32d1-41e9-8959-7c483e43256b",
        "afd948fe-7b48-421b-accb-389619f8456c",
        "5342b7e8-3f8e-4520-ac4e-e0b54f1d1ead"
    ]
}'

Which returned:

{"success":true,"msg":"The provided voters are already registered!"}  

So, this makes me think the default credentials such as alex:alex should work, but it doesn't. What is going on here?

@Kevin-Mok
Copy link
Author

Kevin-Mok commented Aug 9, 2023

So upon further inspection, I found that the root cause of this issue originates from the handleLogin function that is called when you try to login:

const handleLogin = async (username: string, password: string): Promise<void> => {

Here, there is this line:

const token = await EIdentityProviderService.getToken(username, password)

In this getToken function, a POST request is made:

const res = await axios.post(`${IDENTITY_PROVIDER_URL}/getToken`, requestBody)

However, upon checking the web console in the browser, I can see that no POST request is being sent. I'm not sure why it's not and where the code goes from there, but this seems like it would be the source of the problem. I am having problems running the entire setup locally and am having trouble replacing the image used in the docker-prebuilt-up.sh script (#219) so that is also preventing me from further debugging this issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant