Digital Assistant and Mobile

Get Involved. Join the Conversation.

Topic

    Pawan Gupta
    authenticatedUser is not getting setup with IDCSAnswered
    Topic posted October 19, 2019 by Pawan GuptaBlue Ribbon: 750+ Points, tagged Conversational AI, Virtual Assistant, VPA 
    22 Views, 5 Comments
    Title:
    authenticatedUser is not getting setup with IDCS
    Summary:
    authenticatedUser is not getting setup with IDCS
    Content:

    I am using IDCS authenticatino server with OAuth2 system components, i get login page able to login and get correct accessToken though not able to figure out why authenticatedUser is not getting setup. As per documentation, it should work, any help appreciated

    If the user clicks the link to get an access token, it displays the identity provider’s login page or authentication dialog as specified by the authentication service named MyAuthenticationService. After successful login, it obtains the access, sets the myAccessToken and myAuthenticatedUser context variables, and then flows to the state that's named by the pass action

     

    Code Snippet:

    Best Comment

    Frank Nimphius

     

    Hi,

    I've this setting and it works for me

    context:
      variables:
        myAccessToken: "string"
        myAuthenticatedUser: "string"

        
    states:

      login:
         component: "System.OAuth2AccountLink"
        properties:
          prompt: "Login to access your account"
          variable: "code"
          authenticationService: "logAuthService"
          accessTokenVariableName: "myAccessToken"
          authenticatedUserVariableName: "myAuthenticatedUser"
        transitions:
          actions:
           pass: "printSuccess"
           fail: "printFailure"

      printSuccess:
        component: "System.Output"
        properties:
          text: "User: ${myAuthenticatedUser.value}"
          keepTurn: true
        transitions: 
          next: "myAccount"

    Comment

     

    • Pawan Gupta

      tried with both system tester and sample web channel

    • Frank Nimphius

      Hi,

       

      not sure what you mean with "i get login page able to login and get correct accessToken though not able to figure out why authenticatedUser is not getting setup."

      So you are getting an access token for a user but the user is not setup? Makes no sense to me. 

       

      Frank

       

    • Pawan Gupta

      Frank - thanks for input. The issue is, I get accessToken variable populated and it is correctly working. What I am not getting is authenticatedUser variable has no value, i tried both not overriding the variable with my name and overriding in both case it has no value so either i m doing something wrong or there is a bug.. appreciate your input.

    • Frank Nimphius

       

      Hi,

      I've this setting and it works for me

      context:
        variables:
          myAccessToken: "string"
          myAuthenticatedUser: "string"

          
      states:

        login:
           component: "System.OAuth2AccountLink"
          properties:
            prompt: "Login to access your account"
            variable: "code"
            authenticationService: "logAuthService"
            accessTokenVariableName: "myAccessToken"
            authenticatedUserVariableName: "myAuthenticatedUser"
          transitions:
            actions:
             pass: "printSuccess"
             fail: "printFailure"

        printSuccess:
          component: "System.Output"
          properties:
            text: "User: ${myAuthenticatedUser.value}"
            keepTurn: true
          transitions: 
            next: "myAccount"

    • Pawan Gupta

      Found the issue in authentication service setup in the "Subject Claim" i should be putting string "sub" which resolved the issue, your snippet gave me another kick to research something is wrong from my side. Once again thank you Frank, you guys have been so prompt in replying with response.... I love it...