JSFiddle - React, Tailwind, and code Playground

by sperske

JavaScript

Grammarly.init("<your-client-id>").then((grammarly) => {
  grammarly.addPlugin(document.querySelector("textarea"), {
    oauthAssertionProvider: async () => {
    	// Call your endpoint to get an assertion
      const response = await fetch("your server URL")
      if (!response.ok) {
        throw new Error("Error creating assertion")
      }
      return {
        assertion: response.text()
      }
    }
  })
})