You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

65 lines
1.8 KiB

= {pluginname} with JWT authentication (Node.js) Guide
:plugincode: exportword
:pluginname: Export to Word
:navtitle: JWT Authentication setup for {pluginname}
:description: Guide on how to setup JWT Authentication for exporting docx (Microsoft Word) files with {pluginname}
:keywords: jwt, authentication, exportword, node.js
include::partial$auth/document-converters/nodejs/intro-and-prerequisites.adoc[]
include::partial$auth/document-converters/nodejs/initial-project-setup.adoc[]
== Setup
=== Generate a Public/Private Key Pair
include::partial$auth/document-converters/jwt-setup-document-converters.adoc[leveloffset=+2]
include::partial$auth/document-converters/nodejs/server-setup-jwt.adoc[]
=== Web Page (public/index.html)
Inside the `public` folder where you created the `index.html` file add the HTML setup code.
[source,html]
----
<!DOCTYPE html>
<html>
<head>
<title>TinyMCE with Export to Word</title>
<script
src="https://cdn.tiny.cloud/1/no-api-key/tinymce/8/tinymce.min.js"
referrerpolicy="origin">
</script>
<script>
tinymce.init({
selector: 'textarea',
plugins: 'exportword',
toolbar: 'exportword',
exportword_converter_options: {
'document': {
'size': 'Letter'
}
},
// exportword_token_provider fetches a token from the `/jwt` endpoint.
exportword_token_provider: () => {
return fetch('http://localhost:3000/jwt', {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
}).then(response => response.json());
},
});
</script>
</head>
<body>
<h1>TinyMCE Export to Word Demo</h1>
<textarea>
Welcome to TinyMCE! Try the Export to Word feature.
</textarea>
</body>
</html>
----
include::partial$auth/document-converters/nodejs/configuration-steps.adoc[]