FusionAuth
    • Home
    • Categories
    • Recent
    • Popular
    • Pricing
    • Contact us
    • Docs
    • Login
    1. Home
    2. vince
    V
    • Profile
    • Following 0
    • Followers 0
    • Topics 1
    • Posts 1
    • Best 0
    • Controversial 0
    • Groups 0

    vince

    @vince

    0
    Reputation
    1
    Profile views
    1
    Posts
    0
    Followers
    0
    Following
    Joined Last Online

    vince Unfollow Follow

    Latest posts made by vince

    • Issue with POST to /oauth2/token from container inside K8s

      I'm having some issues with my nodejs backend making POST requests to Fusionauths /oauth2/token endpoint when the the nodejs app is running Kubernetes.

      I used the fusionauth provided example for react with a node backend as a template and updated it a bit. It works great when I run it locally on my dev machine but when I run the nodejs backend in a Kubernetes pod I'm getting the following error:
      "Client network socket disconnected before secure TLS connection was established"

      Below is my callback code

      const express = require('express');
      const router = express.Router();
      const axios = require('axios');
      
      
      router.get('/oauth-callback', async (req, res) => {
      
        const uri = `${process.env.FUSION_AUTH_URI}/oauth2/token`;
      
        const form = new FormData();
        form.append('client_id', process.env.FUSION_AUTH_CLIENT_ID);
        form.append('client_secret', process.env.FUSION_AUTH_CLIENT_SECRET)
        form.append('code', req.query.code);
        form.append('grant_type', 'authorization_code');
        form.append('redirect_uri', process.env.FUSION_AUTH_REDIRECT_URI);
      
        axios.post(uri, form, { headers: form.getHeaders() })
          .then((response) => {
            req.session.token = response.data.access_token;
            res.redirect(process.env.FUSION_AUTH_LOGGED_IN_URI);
          }).catch((error) => {
            console.error("error", JSON.stringify(error));
            res.redirect(process.env.FUSION_AUTH_LOGGED_IN_URI);
          });
      
      });
      
      posted in Q&A
      V
      vince