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

Login via Email Magic Link fails in Firefox #40

Open
mrg358 opened this issue Jan 16, 2023 · 10 comments
Open

Login via Email Magic Link fails in Firefox #40

mrg358 opened this issue Jan 16, 2023 · 10 comments
Labels
bug Something isn't working help wanted Extra attention is needed

Comments

@mrg358
Copy link

mrg358 commented Jan 16, 2023

Briefkasten deployed with docker, running behind Nginx Proxy Manager.
I set up Github, Google and Email login.
All of the three login providers works correctly in Brave (chrome).

Login via Email fails in Firefox (tested on ubuntu and android).

[next-auth][error][CLIENT_FETCH_ERROR] 
https://next-auth.js.org/errors#client_fetch_error NetworkError when attempting to fetch resource. 
Object { error: {…}, url: "/api/auth/providers", message: "NetworkError when attempting to fetch resource." }
Copy link
Owner

ndom91 commented Jan 24, 2023

What exactly did you do to provoke that error message? i.e. was that upon clickign the link in the email? Or what?

The error message seems to indicate that the /api/auth/providers endpoint is not available. But this is the endpoint which tells the login page which buttons to render, for example. Therefore, if the login page renders correctly then this endpoint should be working.

Are the links in the email body correct? I.e. if its supposed to be briefkasten.home.com/api/auth/providers, but the email link is maybe still pointing to localhost:3000/api/auth/providers, this coudl cause problems as well.

@mrg358
Copy link
Author

mrg358 commented Jan 25, 2023

E-mail wasn't delivered sent at all. It seems this is a Firefox specific bug only. In Chrome (Brave) everything works.
Authentication stops after hitting "Submit Query" button.
API URL shows "blocked" status and NS_BINDING_ABORTED error message.
You can take a look, here is my deployment
I was searching for solutions, maybe this has something to do with default action on login button, not sure.

@ndom91
Copy link
Owner

ndom91 commented Jan 27, 2023

Okay so I was able to reproduce it on your instance - thanks for providing that link 👍

It also worked for me in Chrome, but as you said, not in Firefox.

Can you check your Vercel API route logs for the /api/auth/[...nextauth].js function? That should have more info for us. Its clearly complaining about the /api/auth/providers endpoint, but that is available under your main domain, so that shouldn't be a problem..

What's your NEXTAUTH_URL set to? Are you using NEXTAUTH_INTERNLA_URL as well by chance?

@mrg358
Copy link
Author

mrg358 commented Jan 28, 2023

actually there are some callback errors in docker, I hope it helps.
https://go.numeo.top/eSNJx

here is part of my my .env vars

# REQUIRED - NextAuth.js
NEXTAUTH_URL=https://bk.d.numeo.top
NEXTAUTH_URL_INTERNAL=http://10.0.0.11:3004

and here is my compose file

version: '3.8'

services:
  postgres:
    container_name: bk-postgres
    image: postgres
    restart: unless-stopped
    environment:
      - POSTGRES_USER=bkAdmin
      - POSTGRES_PASSWORD=<redacted>
      - POSTGRES_DB=briefkasten
        #ports:
        #- 5432:5432
    volumes:
      - briefkasten-db:/var/lib/postgresql/data
  app:
    container_name: bk-app
    labels:
      com.centurylinklabs.watchtower.enable: false
    build: .
    env_file:
      - .env
    restart: unless-stopped
    ports:
      - 10.0.0.11:3004:3000
    depends_on:
      - 'postgres'
volumes:
  briefkasten-db:

@mrg358
Copy link
Author

mrg358 commented Jan 29, 2023

I tried to disable #NEXTAUTH_URL_INTERNAL=http://10.0.0.11:3004 resulted in no change.

@ndom91
Copy link
Owner

ndom91 commented Feb 1, 2023

Do you have a NEXTAUTH_SECRET env var as well? I believe thats still necessary when self-hosting.

See: https://authjs.dev/reference/configuration/env#nextauth_secret

@mrg358
Copy link
Author

mrg358 commented Feb 2, 2023

Yes, I am using NEXTAUTH_SECRET=random-value created with openssl rand -base64 32

@mrg358
Copy link
Author

mrg358 commented Feb 2, 2023

Yes, I am using NEXTAUTH_SECRET=random-value created with openssl rand -base64 32

I tried to search for some clues, and found a result which seems to be very similar to this bug.

Unfortunately I can't test it out b/c a I am not familiar with nextjs.

@ndom91
Copy link
Owner

ndom91 commented Feb 10, 2023

Thanks for the link @mrg358 - I can take a look and see if it fixes the issue in Firefox.

@ingeniumstudio
Copy link

Same here.. works with Chrome tho. Login via Google works in Firefox

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

3 participants