raystack/frontier

Login code not send

Opened this issue · 13 comments

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

@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
- FRONTIER_APP_ADMIN_USERS=sample@example.com

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

how can I set the values in frontier ?

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

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

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.

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 ?

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

FRONTIER_APP_ADMIN_USERS=sample@example.com

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.

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

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 can you share the docker compose file you are using to test it? Omit the username/password value.

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 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 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