FusionAuth
    • Home
    • Categories
    • Recent
    • Popular
    • Pricing
    • Contact us
    • Docs
    • Login

    Token not received inside Docker with Express JS

    Scheduled Pinned Locked Moved Unsolved
    Q&A
    2
    2
    458
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • S
      sandesh
      last edited by

      After adding a authentication layer between Angular and Express JS, I successfully tested the architecture using the 3 servers i.e. Angular, Express JS and Fusionauth. All are working fine.

      When all the setup was moved to docker compose file, I am facing a problem when fusionauth is calling the express JS server - http://localhost:3000/oauth-callback.

      Undefined is returned in the body, hence no token is received. As stated earlier, when tried with Express JS as a separate server and not in the docker file ( Angular and Fusionauth in docker-compose and Express JS as a separate server ) , it is working fine.

      My question, is there any docker configuration required with Express JS server ?

      Docker Configuration of ExpressJS -

      fusionexpressjs:
      image: fusionexpressjs
      ports:
      - 3000:3000

      1 Reply Last reply Reply Quote 0
      • B
        benjamin
        last edited by

        Without understanding your setup completely, is the callback happening in a server-to-server call? If so, localhost doesn't work.

        For example when I wanna call the elastic search container from fusion auth, I cannot call it as http://localhost:9200. For instance if the setup is

          fusionauth-search:
            image: docker.elastic.co/elasticsearch/elasticsearch:8.5.0
            container_name: fusionauth-search
            environment:
              cluster.name: fusionauth
            networks:
              - data-layer
            restart: unless-stopped
            ports:
              - '9011:9011'
        

        I will need to call it via http://fusionauth-search:9200. You can also see such a setup in Fusion Auth's documentation on setting up Fusion Auth in docker-compose at https://fusionauth.io/docs/v1/tech/installation-guide/docker. You notice that the URLs will refer to the container names.

        I hope this helps.

        1 Reply Last reply Reply Quote 1
        • First post
          Last post