frontier icon indicating copy to clipboard operation
frontier copied to clipboard

Login code not send

Open medach2000 opened this issue 1 year ago • 13 comments

When I enter my email, the login code not send inbox.

medach2000 avatar Apr 22 '24 12:04 medach2000

@medach2000 have you configured mailer daemon? Try getting a test account from mailtrap and set the values in frontier, for example if using env vars:

- FRONTIER_APP_MAILER_SMTP_HOST=sandbox.smtp.mailtrap.io
- FRONTIER_APP_MAILER_SMTP_PORT=2525
- FRONTIER_APP_MAILER_SMTP_USERNAME=get it from mail trap
- FRONTIER_APP_MAILER_SMTP_PASSWORD=get it from mail trap
- [email protected]

Mailtrap only send emails on their dashboard, use resend if you want to test it by sending email on actual email account.

kushsharma avatar Apr 22 '24 13:04 kushsharma

how can I set the values in frontier ?

medach2000 avatar Apr 22 '24 14:04 medach2000

How are you running it? You can set it by either passing a config file or by environment variables. https://raystack-frontier.vercel.app/configurations

kushsharma avatar Apr 22 '24 16:04 kushsharma

I clone the project, then i run docker-compose up

medach2000 avatar Apr 23 '24 09:04 medach2000

You can use environment variables I shared above in docker compose for frontier service to configure mailer. Just copy paste them and update with respective values.

kushsharma avatar Apr 23 '24 12:04 kushsharma

ok it works but when I put my email, i receive the code, when I put the code , I receive Unauthorized. How can I access the application ?

medach2000 avatar Apr 23 '24 16:04 medach2000

When do you receive this error? Are you trying to access UI? Did you put your email in?

[email protected]

Note, the UI is still in very early stages. I would advice to interact with frontier via APIs only. You can find all APIs in documentation.

kushsharma avatar Apr 23 '24 16:04 kushsharma

Yes, I put my email to access UI, I want to see Frontier's interfaces

medach2000 avatar Apr 23 '24 16:04 medach2000

Hello @kushsharma I am adding the env in the compose.. u shared above...but still I am not able to get the code out of it ..the smtp service is working fine

shivani446 avatar May 18 '24 10:05 shivani446

@shivani446 can you share the docker compose file you are using to test it? Omit the username/password value.

kushsharma avatar May 19 '24 13:05 kushsharma

Sure @kushsharma


services:
  pg:
    image: postgres:13
    environment:
      - POSTGRES_DB=frontier
      - POSTGRES_USER=frontier
      - POSTGRES_HOST_AUTH_METHOD=trust
    volumes:
      - ./temp/pgdata:/var/lib/postgresql/data
    ports:
      - "5432:5432"
    healthcheck:
      test: [ "CMD-SHELL", "pg_isready -U frontier" ]
      interval: 30s
      timeout: 30s
      retries: 3

  pg2:
    image: "postgres:13"
    environment:
      POSTGRES_USER: "spicedb"
      POSTGRES_DB: "spicedb"
      POSTGRES_HOST_AUTH_METHOD: "trust"
    volumes:
      - ./temp/pgdata2:/var/lib/postgresql/data
    ports:
      - "5431:5432"
    healthcheck:
      test: [ "CMD-SHELL", "pg_isready -U spicedb" ]
      interval: 30s
      timeout: 30s
      retries: 3

  frontier-migrate:
    build:
      context: .
      dockerfile: Dockerfile.dev
    command: ["server", "migrate"]
    restart: on-failure
    depends_on:
      pg:
        condition: service_healthy
    environment:
      - FRONTIER_DB_DRIVER=postgres
      - FRONTIER_DB_URL=postgres://frontier:@pg:5432/frontier?sslmode=disable
      - FRONTIER_SPICEDB_PORT=50051
      - FRONTIER_SPICEDB_HOST=spicedb
      - FRONTIER_SPICEDB_PRE_SHARED_KEY=frontier

  frontier:
    build:
      context: .
      dockerfile: Dockerfile.dev
    ports:
      - "8081:8080" # rest endpoint
      - "8082:8081" # grpc endpoint
      - "8083:8083" # ui
    command: ["server", "start"]
    restart: on-failure
    depends_on:
      pg:
        condition: service_healthy
      frontier-migrate:
        condition: service_completed_successfully
    environment:
      - FRONTIER_DB_DRIVER=postgres
      - FRONTIER_DB_URL=postgres://frontier:@pg:5432/frontier?sslmode=disable
      - FRONTIER_SPICEDB_PORT=50051
      - FRONTIER_SPICEDB_HOST=spicedb
      - FRONTIER_SPICEDB_PRE_SHARED_KEY=frontier
      - FRONTIER_APP_RESOURCES_CONFIG_PATH=file:///opt
      - FRONTIER_UI_PORT=8083
      - FRONTIER_APP_MAILER_SMTP_HOST=****
      - FRONTIER_APP_MAILER_SMTP_PORT=****
      - FRONTIER_APP_MAILER_SMTP_USERNAME=****
      - FRONTIER_APP_MAILER_SMTP_PASSWORD=****
      - FRONTIER_APP_MAILER_SMTP_INSECURE=false
      - FRONTIER_APP_MAILER_SMTP_TLS_POLICY=mandatory  # possible values are "mandatory", "opportunistic", or "none"
      - FRONTIER_APP_ADMIN_USERS=***


  spicedb-migration:
    image: quay.io/authzed/spicedb:v1.29.2
    command: migrate head --datastore-engine postgres --datastore-conn-uri postgres://spicedb:@pg2:5432/spicedb?sslmode=disable
    restart: on-failure
    depends_on:
      pg2:
        condition: service_healthy

  spicedb:
    image: quay.io/authzed/spicedb:v1.29.2
    ports:
      - "7443:8443"
      - "50051:50051"
    command:
      serve --grpc-preshared-key "frontier" --datastore-engine postgres
      --datastore-conn-uri postgres://spicedb:@pg2:5432/spicedb?sslmode=disable --http-enabled=true
    restart: on-failure
    depends_on:
      pg2:
        condition: service_healthy
      spicedb-migration:
        condition: service_completed_successfully

shivani446 avatar May 21 '24 11:05 shivani446

@shivani446 the config looks alright, can you try FRONTIER_APP_MAILER_SMTP_TLS_POLICY=none also do you see any error in logs? When you say but still I am not able to get the code out of it what APIs are you trying to get the code? Are you trying to open admin console? Can you try the sample flow provided in docs for Email OTP via Postman or Curl?

kushsharma avatar May 21 '24 14:05 kushsharma

@kushsharma I am not getting any error logs also the u tried FRONTIER_APP_MAILER_SMTP_TLS_POLICY=none but still its the same ..here code means the verification number we get from the email ..i will try from the link u sent and will get back to u here ...Thanks

shivani446 avatar May 23 '24 05:05 shivani446