2

In my nuxt.js app I'm using nuxts "auth" module to connect to a keycloak instance. It works fine if I only want to login. But if I set the "userinfo_endpoint" in the configuration, to get user info with the login, the requests fails with 401.

nuxt.config.js auth module config:

auth: {
    strategies: {
      keycloak: {
        _scheme: 'oauth2',
        authorization_endpoint: 'https://authenticate.someething.com/auth/realms/app/protocol/openid-connect/auth',
        access_token_endpoint:  'https://authenticate.someething.com/auth/realms/app/protocol/openid-connect/token',
        // if I remove the line with "userinfo_endpoint" the login works, but then I dont get the userinfo I need.
        userinfo_endpoint:      'https://authenticate.someething.com/auth/realms/app/protocol/openid-connect/userinfo',
        scope: ['openid', 'profile', 'email'],
        access_type: 'implicit',
        response_type: 'id_token token',
        token_type: 'Bearer',
        client_id: 'appname',
        token_key: 'id_token',
        state: 'xxx'
      }
    }
  }

The login link in vue calls this function:

this.$auth.loginWith('keycloak')

Is it something in keycload admin interface that I have not turned on?

odadoda
  • 127
  • 7

0 Answers0