S
Supabase2y ago
BPM

Cannot signin/signup 401 unauthorized

I managed to setup a selfhosted docker for supabase, but it is not working 100% as it should. First, I keep getting studio being unhealthy but I can access it just fine at "IP_ADDRESS:3000" from my client. However, my main issue is that when I tried the nextjs subscription example using supabase it keeps giving me 401 error (unauthorized). I checked the request and it has the correct ANON_KEY as the apiKey header and the Authorization Bearer header. When I try to create a new account, I see on my console that it sent:
POST http://MY_SERVER_IP:8000/auth/v1/signup?redirect_to={{CALLBACK_URL}} 401 (Unauthorized)
POST http://MY_SERVER_IP:8000/auth/v1/signup?redirect_to={{CALLBACK_URL}} 401 (Unauthorized)
And a similar error when trying to login to an account I made through studio dashboard.
3 Replies
BPM
BPMOP2y ago
I managed to fix the issue. It seems that the ANON_KEY used for authentication is not exactly the same as the ANON_KEY used for the setup. I realized this after comparing the anon key given by the API docs to the ANON KEY I had in the environment file. It seems that something is added at the end of the original ANON KEY. Is there any documentation on this? And is there a way to get this valid ANON_KEY without having to go to the API Docs or is that the only way to find it? It seems a bit obscure and confusing since they name both ANON KEY...
garyaustin
garyaustin2y ago
There is only one anon key for use in the REST API. That said I don' t know self-hosting setup and what key is where.
BPM
BPMOP2y ago
I realized it was an issue on my part, there is indeed only one ANON_KEY. I'm sorry for the confusion

Did you find this page helpful?