patrickmonteiro / quasarOidcClient

project Quasar Framework with oidc-client library
22 stars 2 forks source link

User profile is undefined when returned #2

Closed Bogatinovski closed 5 years ago

Bogatinovski commented 5 years ago

Upon successful log in the user profile is empty object. Here is my quasar configuration: `OIDC_AUTHORITY: JSON.stringify('http://localhost:5003'),

      OIDC_CLIENTID: JSON.stringify('js'),
      OIDC_REDIRECT_URI: JSON.stringify('http://localhost:8080/#/callback#'),
      OIDC_RESPONSE_TYPE: JSON.stringify('id_token token'),
      OIDC_SCOPE: JSON.stringify('openid profile offline_access'),
      OIDC_SILENT_REDIRECT_URI: JSON.stringify('/silent-renew.html'),
      REDIRECT_CALLBACK: JSON.stringify('/'),
      API: JSON.stringify('http://localhost:9090/api/v1/'),`

Here is the response for the user data and as you can see the profile is empty. If I run the plain javascript oidc-client it works as expected. Am I missing some configuration? { session_state: "bQs03c1xDwP8xMKcoH4aJk989ujBAQjZfCQRKLTiE9I.63a4ff2e459b4b1cd8d89bc4956cf145",…} profile: {} scope: "openid profile" session_state: "bQs03c1xDwP8xMKcoH4aJk989ujBAQjZfCQRKLTiE9I.63a4ff2e459b4b1cd8d89bc4956cf145"

patrickmonteiro commented 5 years ago

@Bogatinovski Is your backend configured to send this profile?

Bogatinovski commented 5 years ago

Yes it is configured. Actually i am using exactly the same backend for the plain javascript oidc client and that one works properly. But this quasar wrapper doesn't work. Note that the quasar wrapper actually reports successful authentication after the redirect and the success callback is executed, but the passed user parameter is undefined. That is so weird.

Bogatinovski commented 5 years ago

I found the problem. First I updated the version of the oidc library to the current latest one (1.6.1). I am not sure if this played any role in fixing the issue. But then in the callback function I chanced the code from the default one in this repo to the following: new Oidc.UserManager({response_mode:"query"}).signinRedirectCallback().then(function(data) { window.location.href = process.env.REDIRECT_CALLBACK }).catch(function(e) { console.error(e); });

The key change here is instantiating new Oidc.UserManager and the addition of {response_mode:"query"}.

patrickmonteiro commented 5 years ago

@Bogatinovski In my project it works as follows, inside callback.vue do: image

And in my App.vue I do: image

In quasar.conf.js

image

For me it worked correctly, did you make it very different from me?

patrickmonteiro commented 5 years ago

I'm closing if the problem persists I'll reopen.