Skip to main content

Notifications

Announcements

No record found.

Power Platform Community / Forums / General / Authenticating User fr...
General
Unanswered

Authenticating User from Vanila Cloud

Posted on by

We are working on building a chatbot where users have different personas and would be authenticated basis grouping done on the website. We have cleared this step however the issue is arising putting that code back to chatbot to call the user in PVA as the website is not a regular ipython frame or css website but it is something built on all together a different product Vanilla OSS, for reference here is the wiki link for details. 

https://en.wikipedia.org/wiki/Vanilla_Forums

Does any one know how to authenticate user who are logged into a website built on a vanilla product i.e. Vanilla OS. 

we have used the below code to pull the user credentials and need to call this back to PVA. (have made some changes to the code to whitelabel it

 

<!DOCTYPE html>

    <html>

    <head>

        <title>Name of the website</title>

        <!-- This styling is for the canvas demonstration purposes. It is recommended

    that style is moved to separate file for organization in larger projects -->

        <style>

            html, body {

                height: 100%;

            }

            body {

                margin: 0;

            }

            h1 {

                font-size: 16px;

                font-family: Font type;

                line-height: size;

                color: color to be selected;

                display: table-cell;

                padding: require dimensions;

            }

            .heading {

                background-color: desired color;

                height:  x px height;

            }

            .main {

                margin: 18px;

                border-radius: x px radius;

            }

 

            div[role="form"]{

                background-color: color;

            }        

            #webchat {

                position: fixed;

                height: calc(required height);

                width: as desired%;

                top: 50px;

                overflow: xxx;

            }

          </style>

    </head>

    <body>

        <div>

            <div class="heading">

 

                <!-- Change the h1 text to change the bot name -->    

                <h1>Name of the BOT</h1>

 

            </div>

            <div id="webchat" role="main"></div>

        </div>    

      <script src="https://cdn.botframework.com/botframework-webchat/latest/webchat.js"></script>

      <script>

            const styleOptions = {

               // Add styleOptions to customize web chat canvas

               hideUploadButton: true

            };

 

            // Add your BOT ID below

            var BOT_ID = "<ENTER YOUR BOT ID>";

 

            var theURL = "Add the URL";

 

            const store = window.WebChat.createStore(

               {},

               ({ dispatch }) => next => action => {

                   if (action.type === "DIRECT_LINE/CONNECT_FULFILLED") {

                      dispatch({

                          meta: {

                               method: "keyboard",

                           },

                           payload: {

                               activity: {

                                     channelData: {

                                          postBack: true,

                                     },

                                      //Web Chat will show the 'Greeting' System Topic message which has a trigger-phrase 'hello'

                                      name: 'startConversation',

                                      type: "event"

                                 },

                            },

                            type: "DIRECT_LINE/POST_ACTIVITY",

                       });

                 }

                 return next(action);

              }

           );

           fetch(theURL)

                .then(response => response.json())

                .then(conversationInfo => {

                    window.WebChat.renderWebChat(

                        {

                            directLine: window.WebChat.createDirectLine({

                                token: conversationInfo.token,

                            }),

                            store: store,

                            styleOptions: styleOptions

                        },

                        document.getElementById('webchat')

                    );

                })

                .catch(err => console.error("An error occurred: " + err));

        </script>

      </body>

    </html>

Categories:
  • JoseA Profile Picture
    JoseA 20 on at
    Re: Authenticating User from Vanila Cloud

    I think it's best to update the post and include a Pastebin link for the code. 

     

    Have you tried using the instructions here - 

    Configure user authentication - Power Virtual Agents | Microsoft Learn 

    Configure single sign-on - Power Virtual Agents | Microsoft Learn

     

    Let us know how it goes

Helpful resources

Quick Links

Exciting News for Copilot Studio Communi…

Get ready to experience a whole new level of engagement with the Copilot Studio…

Celebrating the May Super User of the…

LaurensM is an exceptional contributor to the Power Platform Community…

Check out the Copilot Studio Cookbook…

We are excited to announce our new Copilot Cookbook Gallery in the Community…

Leaderboard

#1
renatoromao Profile Picture

renatoromao 6,459

#2
Pstork1 Profile Picture

Pstork1 1,954

#3
Expiscornovus Profile Picture

Expiscornovus 1,662