Git Product home page Git Product logo

nuxt-oidc-auth's Introduction

Hi there! ๐Ÿ‘‹

I am Jan-Henrik, a Microsoft Azure MVP and Senior Cloud Architect. I am the CTO of @VisorianGmbH. I work on projects with serverless/cloud native architecture, cloud migrations, cloud native development, cloud security as well as cloud journey and vendor/architecture reviews. My main job is to help companies implementing all of these reliable at enterprise scale.

I am interested in modern Web Development strategies and technologies as well as everything Serverless, JAMStack and Automation with CI/CD.

PS: As a former PowerShell MVP, I know only one true default shell on all operating systems (Windows, Linux/Unix, MacOS) ๐Ÿ˜‰

Links/Contact

Azure MVP Mail LinkedIn GitHub Twitter Blog

Technologies

Azure Functions Azure Static Web Apps Supabase TypeScript Nuxt Vue UnoCSS Windows Terminal VSCode PowerShell GraphQL Prisma Azure CosmosDB MongoDB PostgreSQL Playwright Vitest Bicep Terraform Kubernetes GitHub Actions Vault Azure Networking

Best practices/tools

Well-Architected Framework Architecture Center Cloud journey Azure MVP

GitHub stats

nuxt-oidc-auth's People

Contributors

ahmedrangel avatar aksharahegde avatar arashsheyda avatar atinux avatar azurency avatar berzinsu avatar danielroe avatar gerbuuun avatar itpropro avatar jfrelik avatar justserdar avatar leomo-27 avatar samulefevre avatar sifferhans avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

nuxt-oidc-auth's Issues

403 from Issuer when redirect URL is not encoded

Hi all, thank you for this well documented code!
I'm not sure if this is an issue with me, nuxt-oidc-auth or my issuer (nextcloud with OIDC Identity Provider).
This is my first try, to use the openid connect workflow and there may be a lack of understanding.

I'm using this config:

oidc: {
    defaultProvider: 'oidc',
    middleware: {
      globalMiddlewareEnabled: false
    },
    providers: {
      oidc: {
        clientId: process.env.NUXT_OIDC_PROVIDERS_OIDC_CLIENT_ID,
        clientSecret: process.env.NUXT_OIDC_PROVIDERS_OIDC_CLIENT_SECRET,
        redirectUri: 'http://localhost:3000/auth/oidc/callback',
        authorizationUrl: 'https://mydomain.de/apps/oidc/authorize',
        tokenUrl: 'https://mydomain.de/apps/oidc/token',
        userinfoUrl: 'https://mydomain.de/apps/oidc/userinfo',
        scope: ['profile', 'openid', 'email'],
      }
    },   
  }

When the authorization URL is called by the application, the module appends

&redirect_uri=http://localhost:3000/auth/oidc/callback

to the call, which results in a 403 error. I double checked, that the correct redirect url is also in the nextcloud provider config.

If I change the parameter to

&redirect_uri=http%3A%2F%2Flocalhost%3A3000%2Fauth%2Foidc%2Fcallback

it works (however, I get a state error, which is perfectly fine from my understanding, when I change the call manually).

So I tried to wrap the parameter in an encoding function
redirectUri: encodeURIComponent('http://localhost:3000/auth/oidc/callback')

Now the parameter gets also encoded by the module, so as a result it is encoded twice:
&redirect_uri=http%253A%252F%252Flocalhost%253A3000%252Fauth%252Foidc%252Fcallback

Now I'm a little bit lost, can someone give me a hint on what I'm missing?

Implement Apple OIDC authentication

Implement a preset for Apple OIDC autentication

  • Create a provider stub
  • Define additional provider fields
  • Implement the ability to use a function for the client secret (requested each time from apple)
  • Add the ability to provide signed JWT to authenticate against the client secret endpoint

`This module cannot be importedin server runtime.`

Jus updated from nuxt 3.9.1 to 3.9.3 and I get this error in the console now when I start with yarn dev:

This module cannot be importedin server runtime. [importing @nuxt/kit from node_modules/nuxt-oidc-auth/dist/runtime/server/lib/oidc.mjs]
This module cannot be importedin server runtime. [importing node_modules/@nuxt/kit/dist/index.mjs from node_modules/nuxt-oidc-auth/dist/runtime/server/utils/session.mjs]

Not 100% sure if it's a bug in the plugin or in Nuxt itself.

Cannot find module '#imports'

Just saw there has been some update since this morning, so I was trying the latest 0.9.10 and got this error:

Error while requiring module nuxt-oidc-auth: Error: Cannot find module '#imports'
Require stack:

  • /Users/sleblanc/www/nuxt-3-keycloak-auth/node_modules/nuxt-oidc-auth/dist/module.mjs

`Token request failed`, not sure how to debug

Hi, I find it quite hard to debug, but I'm new to Nuxt 3 (coming from Nuxt 2).
There is only one non-functioning exemple in the "playground" folder and the documentation is pretty light on details.
I'm trying to make this work with Keycloak but I get Token request failed after login in the SSO and being redirected.

Screenshot 2024-01-17 at 10 17 37โ€ฏAM

Previously I was using@hebilicious/authjs-nuxt @auth/core, but I couldn't make i18n redirect work or fetch additional user data before login so I hoped this plugin would work and support both of those things.
i18n is still unclear, but I see there is a sessionHooks.hook('fetch') for my second problem.

Here is my config:

oidc: {
    defaultProvider: 'keycloak',
    providers: {
        keycloak: {
            audience: 'account',
            baseUrl: 'http://eeq-sso.local.vici.io/auth/realms/eeq',
            clientId: 'campus-virtuel-nuxt3',
            clientSecret: '',
            redirectUri: 'http://localhost:3000/auth/keycloak/callback',
        },
    },
    session: {
        expirationCheck: true,
        automaticRefresh: true,
    },
    middleware: {
        globalMiddlewareEnabled: true,
        customLoginPage: true,
    },
},

Here is my .env:

NUXT_OIDC_TOKEN_KEY=UVZA2QeeHvJ9SuUbJpNrBUNUXwusJxmakp2DtekMHvvt3r9m
NUXT_OIDC_SESSION_SECRET=fyfutx8Mp4JeKgqa7CX4rCMj2KtVsJxuPmFmsYPqQDZWVNcZ
NUXT_OIDC_AUTH_SESSION_SECRET=KcmJyqyvwaTe3EzQXMQKDWKffXKaaWhgEhY2EbEJyUmd8KBX
#
NUXT_OIDC_PROVIDERS_KEYCLOAK_CLIENT_ID="campus-virtuel-nuxt3"
NUXT_OIDC_PROVIDERS_KEYCLOAK_CLIENT_SECRET="37cd4c2c-db90-4781-9c29-ca172a8c30a7"
NUXT_OIDC_PROVIDERS_KEYCLOAK_BASE_URL="http://eeq-sso.local.vici.io/auth/realms/eeq"

Also, maybe I'm misunderstanding something about NUXT_OIDC_TOKEN_KEY, NUXT_OIDC_SESSION_SECRET and NUXT_OIDC_AUTH_SESSION_SECRET because the line in the docs to generate them does not work
await subtle.exportKey('raw', await subtle.generateKey({ name: 'AES-GCM', length: 256, }, true, ['encrypt', 'decrypt'])) and I'm not quite sure what base64_encoded_key means vs 48_characters_random_string.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.