[solved] Authenticate Users with MetaMask using Python and Django

Hello guys.

in this topic at the end of that when i want to start the application, every time i get an “authentication error”.
i searched about this problem and seems it backs to connecting metamask to a local domain. is it true?
if it’s true, so how could we solve this problem with the local domain?

Can you give more info about that error? It is an error in MetaMask or in another place?

this is a step-by-step screenshot after running the

application with code on the Github repository.

you have to change the domain that is set when the message is requested from authentication api. The domain has to march to domain that is accessed in the browser

once i used the local IP and once I used my self-made local domain. every time I got a different error and got screenshot for you

.

try to use ngrok as a proxy and then use the domain with the subdomain obtained from ngrok
you don’t have to put there the complete path in the domain field, only the domain, like

4asiasdfhaiuhf.com

or a subdomain like

asdf.23432asdfasdf.com

with the ngrok got this error and couldn’t go forward.

remove that / from the end of the domain, maybe ngrok was not configured right, it should redirect all the request to your local server

you can use the application with that warning and fix it later, that is only an warning added recently by metamask extension to check that domain field that it matches with the domain from the browser

even without / I have again the same error :frowning: . Now it does not even get to the metamask warning message. Even before, I was not really worried about the metamask warning message. It’s just that the code does not go through. I was getting “Authentication Error” at the end. That is what I am trying to resolve.

was was causing the authentication error? was there any error message?

you have to sign that message faster than that timeout of 100 seconds

yes I did even more faster than this.

what was the error that you got in that case?

after that red one in the terminal, nothing goes forward and no error appears to me.

something doesn’t seem to work as expected here, it looks like /we3_auth/request_message returns a 403 status code

what happens when you try it without ngrok and you get that warning in metamask if you complete the authentication?

These two screenshots are related to when I used mylocaldomain.com as the domain.
and after I signed that warning, I got “authentication error”.

you are running it with a debugger?

I am using Visual Studio, and adding Breakpoint() and continue to debug. I am running the entire package using the terminal (command line) -> run server, just like instructions in the tutorial

can you try without using the breakpoints to see what happens?

there is another step where it has to validate the signature at the end, between when the message is generated and and the signature is validate it has to take less than 100 seconds

yeah, I got you but the old authentication error still appears.

it is a message expired error there, meaning that it took more than 100 seconds from the beginning when the message was requested from auth api until the signature was validated with the second request to auth api

1 Like