Sidebar

Surface Glean search, chat and contextual recommendations for the current page in a Sidebar.

sidebar1 sidebar2


Add Javascript API client

Include the JS library in the <head> of your page, where YOUR_GLEAN_DOMAIN is where your company accesses Glean, such as app.glean.com, company.glean.com, etc.

Copy
Copied
  <script defer src="https://{YOUR_GLEAN_DOMAIN}/embedded-search-latest.min.js"></script>

Setup

Call EmbeddedSearch.openSidebar when desired (e.g. in response to a button click).

Copy
Copied
  <script>
    EmbeddedSearch.openSidebar()
  </script>

Recipe

This codepen demonstrates how to embed a Glean Sidebar.

Customizations

Authentication

By default, upon first usage, the user will have to both:

  1. Enter their email address and
  2. Perform SSO authentication

The first step can be avoided by passing the backend parameter.

The second step can be avoided by configuring a server-to-server handshake and passing the user's auth token to Options.authToken.

Note

When passing an authToken, a onAuthTokenRequired callback must also be configured to ensure that the token is refreshed when it is nearing expiration.

Note that if the user's browser disallows third party cookies then SSO authentication will not work and server-to-server authentication is required.