Error Connecting Client with the backend

I have been trying to create some test apps using the tutorials defined in weavy docs but for some reason I am not able to connect my client with the backend.

I use the following html code

<!DOCTYPE html>
<html lang="en">
    <head>
        <meta charset="utf-8" />
    </head>
    <style>
        #messenger-container {
            position: fixed;
            top: 0;
            bottom: 0;
            z-index: 1000;
            transition: transform, opacity;
            transition-duration: 0.2s;
            transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1);
            right: 0;
            width: 20rem;
            transform: translateX(20rem);
            pointer-events: none;
            height:100px;
        }
        #messenger-container.open {
            transform: none;
            border-left: 1px solid #ccc;
        }
 
    </style>
<body>
    <div id="messenger-container">
        <button class="toggle-messenger">Toggle Messenger</button>
    </div>
    <script src="https://code.jquery.com/jquery-3.3.1.min.js"></script>
    <script src="https://localhost:44326/javascript/weavy.min.js"></script>
    <script>
        $(function() {
            var token = "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiI1NDYxMiIsIm5hbWUiOiJUZXN0bmFtZSIsImV4cCI6MTYzMDA1MDE4OCwiaXNzIjoiZW50ZXIteW91ci1jbGllbnQtaWQiLCJlbWFpbCI6InRlc3RAZXhhbXBsZS5jb20ifQ.rkKIZPt_EbyJY0GrVpIoMZQcWzVulVMtAOXyk2Hvn_4";
            var weavy = new Weavy({jwt:token});
            var space = weavy.space({ key: "global"});
            var messenger = space.app({ key: "messenger", type: "messenger", container: "#messenger-container", open: false});
            $(document).on("click", ".toggle-messenger", function() {
                messenger.toggle();
                $("#messenger-container").toggleClass("open");
            });
        });
    </script>
</body>
</html>

when I use this code I get the following message on console

and for some reason,it still manages to create a user on the backend,but still no UI being shown


as shown in the previous blog
I even tried changing the code in webconfig
as

  <appSettings file="settings.config">
    <add key="weavy.cors-origins" value="file:///C:/Users/user/Documents/MyWeavyTutorial/index.html" />
  </appSettings>

and now it shows this error

how can I proceed with this? @ayush , @Kris ?

1 Like
  1. You can’t open your webpage from the file system. You have to run it via a web server.
  2. The cors-origins setting should be the url to your application and not a file path.
2 Likes

@linus @ayush and @Kris thanks a lot for this…i realised by mistake…I was having an issue with my jwt authentication code.Once I was able to fixed that,I was able to integrate with weavy.I have tested majority of the apps and they seem to be working great.

Will provide an example project focusing on properly integrating with weavy very soon :grin: :grin:

1 Like

Get in touch with our technical team by joining our developer community.





Developer Community

Post your questions on the Community and get help from Weavy Developer Support