kindeClient.getUserOrganizations() its returning Compact JWS must be a string or Uint8Array
I am getting an error when fetching: kindeClient.getUserOrganizations() its returning Compact JWS must be a string or Uint8Array, but when I fetch other functions works correctly
any idea why this might happen?
My setup is Nuxt+NitroJS (nodejs)
I have setup:
1. M2M to fetch tokens to make endpoint api calls
2. Copy/Pasted the nuxt-kinde
server/
code to my nitro app
Tried asking KindeAI, but to no avail.18 Replies
Hello @Oli - Kinde @viv (kinde) sorry to ping you on this, but this issue is very difficult to debug.
when accessing some functions the call are successful, in some other functions like
getUser
the functions throws this error.
getUserProfile
works
getUser
throws the above error
getToken
works
getOrganization
works
getUserOrganizations
doesnt work
Why is this the SDK so inconsistent?
CC: @Daniel_KindeHey @9M6,
Whats SDK are you using?
Hello @Oli - Kinde I'm using the node typescript sdk
is this a known issue?
I've also copied code from the nuxt-kinde
server/
library to my nitro
projectHi @9M6,
No this is not a known issue.
I will get a member of my team to look into this
Have you tried the Nuxt SDK?
I use that on the nuxt app, but I'm separating the backend from nuxt
so I'm using both
nuxt + backend with nitro
and migrated some code into nitro
it should work the exact same same
since the middleware and the util functions are the same
Okay I will reach out to a team member of mine to look into this issue.
I need this since I am also adding the kinde management api
Thank you!
Hi @9M6, just so I get on the right page, you're not using the Nuxt Module and building your own implementation with the TS SDK?
There is no need to build your own management API layer, we have a packge which fully works with Nuxt already for this: https://github.com/kinde-oss/management-api-js
GitHub
GitHub - kinde-oss/management-api-js: javascript package for intera...
javascript package for interacting with the Kinde Management API - kinde-oss/management-api-js
Hey @Daniel_Kinde
First, I am already using
nuxt-kinde
on my nuxt app, but also I am building an API backend which I am using part of nuxt-kinde
package, specifically the files in the server/
directory in there.
I've integrated them into a separate nitro
application, that will handle:
1. Authentication
2. Management API
In there I've setup the Backend Application and a Machine 2 Machine Application, the auth layer is handled by the Backend application, while I get a oauth/token
form M2M application, which then I will make requests on the backend for Management API.
Also I am already using that API, I think it comes pre-bunddled with Kinde TypeScript SDK
while I get a oauth/token form M2M application, which then I will make requests on the backend for Management API.
All that is handled by the management-api-js
linked above, the APIs in the TS SDK will likely be removed in future versions.Oh thats nice!
but @Daniel_Kinde what about the other error? This JWT token issue
its not related to the management API but the typescript SDK for the user api
getUserProfile works
getUser throws the above error
getToken works
getOrganization works
getUserOrganizations doesnt work
These are functions from typescript SDK when initialised through:
createKindeServerClient
I'm using GrantType.AUTHORIZATION_CODE
The same implementation on nuxt-kinde
@Daniel_Kinde switched to the new SDK, looks nice, but would be very nice if the init()
function had a config parameter to pass down the env (automatically inferring the values from env variables is good too but the config will allow more customization)
Also why there's is not any filtering capabilities for the endpoints. Example getOrganisations, would be nice to have a userId
in there to filter based on that. Otherwise I would have to paginate through all orgs to filter it.
@Daniel_Kinde it seems the only way to get additional details on the user is to use JWT tokens, and not any API. (Took me a while to understand this 😓 )You can access all the users properties using the
Users.getUserPropertyValues
method
Is there something specifc you feel like you're missing?@Daniel_Kinde its returning only these props, but no organisation:
Seems
getUserData
did the trick
@Daniel_Kinde is there any method in the libraries where I can check the JWT token against the jwks
endpoint?
I saw some utility functions in the typescript libary but not sure if they're exported or for public access?Indeed there is https://github.com/kinde-oss/jwt-validator
GitHub
GitHub - kinde-oss/jwt-validator
Contribute to kinde-oss/jwt-validator development by creating an account on GitHub.
Hey @Daniel_Kinde how to set the
config
during runtime? I'm using cloudflare pages, and .env
are only set during the execution.
if I just replicated/modified on my nitro app, the index.js
with the config.js
file in kinde-management-api, will it work?
Any way of setting the Auth Domain, Client Id, and Client Secret?@Daniel_Kinde sent a PR with the changes https://github.com/kinde-oss/management-api-js/pull/8
GitHub
add config object in init() by 9M6 · Pull Request #8 · kinde-oss/ma...
Explain your changes
Add a config parameter to the function init() the reason being is that there're cases where there's need to overwrite default configuration.
Ex: cloudflare pages only p...
Hey @Daniel_Kinde managed to look into this?
I tried and works on my side, I also deployed my app on couldflare using my repo in the package manager
Its on my list to review today