Add BDK to an Extension App for Circle of Trust
Prerequisites
Complete the previous guide on building an extension app with app views
Build an Extension App with App ViewsComplete the first part of this guide with the assistance of your pod administrator, ensuring that your app has the Primary User Identity and Trust application permissions.
Add an Extension App to a Symphony PodThis guide will use a shared extension app entry that is available for everyone to use on the developer sandbox. The app id is localhost-4000
and the RSA private key can be downloaded from this location. This entry expects that the app is hosted on https://localhost:4000
with the entrypoint controller.html
at the root.
User Identity
In order to obtain identity information of the current user, an extension app needs to perform an authentication call and validation loop as part of the Circle of Trust process. This requires a backend service to call Symphony REST APIs so as to secure the required private key. You can choose to manually create your own REST API client and link the endpoint contracts to the ADK configuration, but this guide will demonstrate how to use BDK to ease the process.
Create BDK Project
Configuration
As we won't be using the bot components, we can remove configuration relating to bots. We will also remove the TLS configuration as we will use ADK to host the frontend app instead. We also need to expand the CORS configuration as our frontend will make a cross-origin call to this backend in development mode (modify as appropriately for production).
If you are using your own extension app id and key, change the values as appropriate. If you are using the developer sandbox, download this key into rsa/privatekey.pem
.
Start Backend
Either launch the BDK project from your IDE or use the respective maven or gradle command:
Build ADK App
Modify the index.js
or index.ts
file from the earlier ADK project to be as follows:
Note that we previously only supplied id
to the ADK.start
call but we now supply an additioinal circleOfTrust
object in that configuration. This object has 3 properties that each return a promise.
getAppToken
: calls the backend to perform app authentication and retrieve the tokenvalidateAppToken
: calls the backend to perform token validationvalidateJwt
: calls the backend to perform JWT validation
ADK takes care of adherence to the Circle of Trust process so you only need to define these contracts to allow ADK to perform the required backend calls.
Now that the app is authenticated, we can fetch user identity from either the controller or views. Let's edit the existing view to be as follows:
Start the App
We can now start the app using:
Load the App in Symphony
Instead of performing bundle injection as before, load Symphony normally now. Once Symphony is loaded, open the Marketplace using the left rail. Locate your App and install it. If you are using the developer sandbox, the app's name is Localhost 4000.
Test the App
Once the app is installed, you should notice a new app appears in the Apps section labelled as My App. If you launch the app, it opens a module showing the view, which contains your display name and email.
Last updated