getUserIdentityToken() not resolving

Hello,

I am trying to use Single Sign-On with my Sky addin, but when I call client.getUserIdentityToken() I cannot get the Promise to resolve.

My code is as follows:

var client = new window.BBSkyAddinClient.AddinClient({…}) <-- This all works
client.getUserIdentityToken( ).then((token) => {
‎ ‎ ‎ ‎ ‎ ‎ ‎ ‎ var userIdentityToken = token;
‎ ‎ ‎ ‎ ‎ ‎ ‎ ‎ console.log(token)
})

It never reaches the inside of .then( ). When I log the client itself, I see that the client object populates authTokenRequests and changes lastAuthTokenRequestId to 1, but I cannot get the token itself.

Any ideas why?

Thanks,
Kevin

Comments

  • Michael Tims
    Michael Tims Blackbaud Employee
    Sixth Anniversary Kudos 2 Name Dropper Participant

    Hi @Kevin Li - does this happen for a particular extension point, or do you see the problem with any type of add-in (extension point)? Are there any additional errors in the browser console that seem related to the AddinClient?

  • Hi @Michael Tims - I have tested with the extension points “Development Office Home Action (Preview)”, “Constituent Page Action (Preview)”, and “Page (Preview)” (since the first 2 Addin navigate to the Page addin). They all behave the same.

    I am not receiving any other errors in my console related to the AddInClient.

    Here is an image of my AddInClient if it helps.

    952a5a983ca34acee5eac9763fc8ae08-huge-im

    Another thing to note is that I have client.navigate( ) working for the buttonClick, so the client itself is working.

  • @Michael Tims
    Here are my console logs:

    8cb4daf1babbd691ffeaa9fd215d7639-huge-im
  • Michael Tims
    Michael Tims Blackbaud Employee
    Sixth Anniversary Kudos 2 Name Dropper Participant

    @Kevin Li - thank you for the information! I have logged a bug with our team within Blackbaud to fix the problem. These extension points appear to not be properly wired up to handle the identity token request. I will keep you posted on the progress - no need to file a bug with Support, I plan to work on a fix this week. Thanks!

  • Michael Tims
    Michael Tims Blackbaud Employee
    Sixth Anniversary Kudos 2 Name Dropper Participant

    Hi @Kevin Li - after a bit more troubleshooting, it does actually look like the extension points are generally working for the fetching of identity token.

    A couple other questions and things to try:

    • Are you using the latest version of the sky-addin-client package? https://www.npmjs.com/package/@blackbaud/sky-addin-client
      • Please update to v1.2.0 if not already on the latest.
    • To rule out any timing-related issues, are you able to fetch the token if you make the call on the button click, so for example in the Development Office Home Action button click?
  • @Michael Tims

    • I have updated to v1.2.0, was previously using v1.1.5.
    • I have figured out a few ways to make the call work:
      • Calling it in the callbacks init function
      • Calling it in buttonClick function
      • Calling it in a setTimeout( ) with ≥1ms delay

    Thanks for your help. On another note, after validating the token, will I be able to use this token to make SKY API calls?

  • Michael Tims
    Michael Tims Blackbaud Employee
    Sixth Anniversary Kudos 2 Name Dropper Participant

    @Kevin Li

    Calling it in the callbacks init function

    Yes, that's right. My bad, I should've seen that. You need to wait until the init callback occurs before you can fetch the identity token. init indicates that the host page and add-in client have initialized their communication and the host page can now receive calls from the client.

    On another note, after validating the token, will I be able to use this token to make SKY API calls?

    No, the identity token is used to support SSO between a user in your system and a Blackbaud user. Here's the Add-in SSO documentation. And here is the documentation to connect your add-in to SKY API.


  • @Michael Tims
    Thank you for your help and information. I honestly should have seen this myself as well so I don't blame you. The documentation is a little misleading though as the example made me think that I wouldn't have to wait for the init callback to finish.