Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Both clientId and client_id are required for VuexOidcClientSettings #204

Open
Santobert opened this issue Jan 9, 2023 · 4 comments
Open

Comments

@Santobert
Copy link

With version 4.0.1 clientId and client_id are expected attributes of VuexOidcClientSettings as well as redirect_uri and redirectUri.

const clientSettings = {
  authority: [...],
  clientId: [...],
  redirectUri: [...],
  responseType: "code",
  scope: "openid email profile",
  automaticSilentRenew: true,
  automaticSilentSignin: false,
  accessTokenExpiringNotificationTimeInSeconds: 10,
  extraQueryParams: { nonce: nanoid() },
} as VuexOidcClientSettings;

export default vuexOidcCreateStoreModule(
  clientSettings,
  {
    namespaced: true,
    routeBase: [...],
  },
);

This leads to the following error:

Conversion of type '{ authority: string; clientId: string; redirectUri: string; responseType: string; scope: string; automaticSilentRenew: true; automaticSilentSignin: false; accessTokenExpiringNotificationTimeInSeconds: number; extraQueryParams: { ...; }; }' to type 'VuexOidcClientSettings' may be a mistake because neither type sufficiently overlaps with the other. If this was intentional, convert the expression to 'unknown' first.
  Type '{ authority: string; clientId: string; redirectUri: string; responseType: string; scope: string; automaticSilentRenew: true; automaticSilentSignin: false; accessTokenExpiringNotificationTimeInSeconds: number; extraQueryParams: { ...; }; }' is missing the following properties from type 'VuexOidcClientSettings': client_id, redirect_urits(2352)

In addition, the accessTokenExpiringNotificationTimeInSeconds attribute also seems to be an issue, although it works as expected.

@perarnborg
Copy link
Owner

I see, I had missed this difference between oidc-client and oidc-client-ts – in the type definition (that vuex-oidc extends) in oidc-client client_id and redirect_uri are not required.

I think the easiest fix is to set clientId and redirectUri as optional in the vuex-oidc interface VuexOidcClientSettings. This will force typescript users to set client_id and redirect_uri rather than clientId and redirectUri - so it will introduce a braking change for typescript. But still better than now that both syntaxes are required.

I will fix this within short!

@dr-waterstorm
Copy link

dr-waterstorm commented Mar 6, 2023

Thanks @perarnborg for all your efforts! It's awesome to see that this lib is migrating to the new TS version.

Is there an ETA for this fix? I've ran into the same issue.

My "workaround" currently is using the TS naming scheme from oidc-client and a

// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore
vuexOidcProcessSilentSignInCallback(oidcSettings)

for the linter to still accept the code :)

@perarnborg
Copy link
Owner

perarnborg commented Mar 9, 2023

Previous ETA was within short from jan 11. I seem to have failed with that. 😉

I will probably find the time to fix this let’s say this month. Hopefully sooner than the end of this month. But a bit stressed for time at the moment.

@perarnborg
Copy link
Owner

This is fixed in v4.0.2. TS users should now set client_id and redirect_uri (snake_cased), as they are specified in oidc-client-ts

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants