Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

341
Visualizações
How can I setup an OpenID Connect authentication with Node Js?

here is the thing. I have my app that has separated back-end and front-end into two different project (back-end with Node-JS, and front-end with Vue-JS). I got a home page with a button that should redirect the user to the authentication server to log in.

So i made an "on-click" function in my homePage.vue that will consume a function from my api.

I've read a lot of documentation and seen some examples. But to be honest, during those past weeks, even if I tried, I still do understand nothing about how authentication works.

You can see below the js file i wrote inspired by examples that i found:

auth.js

const express = require('express');
const { auth } = require('express-openid-connect');
const app = express();

app.use(
    auth({
        issuerBaseURL: 'myDomainUrl',
        baseURL: 'http://localhost:8080',
        clientID: 'myClient_ID',
        secret: 'aaaaaaaaaaaaaaaaaaaa',
        idpLogout: true,
            authRequired: false,
    })
);
module.exports = app;

There is also the route with the function that I try to implement:

auth.route.js

module.exports = app => {
    var router = require("express").Router();


    router.get('', location.replace('myDomainUrl'));
    app.use('/api/login', router);
};

I don't know if it's important but my back-end runs on the port 4000 and my front-end runs on the port 8080.

If someone can explain me how I can do to make my authentication work and what I have to change, it would be great.

Thanks you in advance, I hope I was clear enough about my problem. If not, do not hesitate to ask me what was not clear.

about 4 years ago · Santiago Trujillo
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda