Andy V
KKinde
•Created by Andy V on 2/15/2024 in #💻┃support
Single authentication/two applications
Hi @Andre @ Kinde
Thanks for the details. Looks like I have managed to get this sorted now. The important bit I was missing was performing the
login()
call from the second app. This seems like a pretty big oversight on my part now that I think about, it but was not being done with the existing Auth0 implementation that I am replacing. Things you learn ...
One problem I am having is I can't use wildcards in the "Allowed callback URLs". For example I can't use https://*.example.com
for my callbacks, however I can use https://app.example.com
and https://clients.example.com
. I am pretty this has already been raised in another post.
Again, thanks for your help.
For anyone else interested in the steps I did:
1. Create one Kinde frontend application in you Kinde dashboard.
2. Configure the "Allowed callback URLs" to include a URL for both https://app.example.com and https://clinets.example.com
3. For https://app.example.com (which is a React app) follow the docs to add the React SDK and add the provider Context component with the configuration details from the Kinde app you created in step 1.
4. For https://clients.example.com (the JavaScript app) add the JavaScript SDK
5. When the JavaScript app is initial loaded, create a Kinde Client with the redirect_uri
pointing to the client apps callback.
6. Once the client is created use isAuthenticated()
to see if the user is authenticated. If they are continue as normal. If they are not, call login()
and this will perform a call to Kinde, see the user already has a "session" and authenticate the user without displaying any login screens. The user will be redirected back to the redirect_uri
and now isAuthenticated()
will return true.4 replies