description: Details on how to get help if you get stuck in getting Tiny Drive up and running
keywords: help
---
### Get help with Tiny Drive
> If you haven't tried any of the [Starter projects]({{site.baseurl}}/tinydrive/getting-started/) yet, we urge you to try them before trying to implement your own solution. The source is also available on Github to study.
Getting started with Tiny Drive can be tricky if you are new to JWT. You can get some help from our support by submitting a support request here.
[>> Submit support request](https://support.tiny.cloud/hc/en-us/requests/new)
Before you start your journey with Tiny Drive, you will need these keys.
Before you start your journey with Tiny Drive, it will go a lot smoother if you have done these steps:
1. Login/register to [tiny.cloud](https://apps.tiny.cloud/my-account/)
2. Get a [TinyMCE API Key](https://apps.tiny.cloud/my-account/key-manager/)
3. Get a [JWT Key](https://apps.tiny.cloud/my-account/jwt-key-manager/)
Store the keys temporarily somewhere, you will need to copy & paste them later.
## Starter projects
To get started quickly and understand how Tiny Drive works, we highly recommend trying one of the starter projects, should get you up and running in no time.
To get started quickly and understand how Tiny Drive works, we highly recommend trying one of the starter projects on Github, should get you up and running in no time.
The starter projects have their own 5 steps to get Tiny Drive running, follow those steps.
If you do not have any experience with these languages, it might still be useful to see how they work and then try to implement your own solution.
We really recommend giving these starter packages a try, it will help you understand how authentication and integration can work in your system. You can then move on and try to implement Tiny Drive into your system.
**We really recommend giving these starter packages a try**, it will help you understand how authentication and integration can work in your system. You can then move on and try to implement Tiny Drive into your system.
## Implementing with your system
After seeing it running, the next step would be to figure out how to implement it with your own system. You need to tie our JWT Authentication solution to the login authentication of your system, usually sessions are used for this kind of authentication.
After seeing it running, the next step would be to figure out how to implement it with your own system. You need to tie our JWT Authentication solution to the login authentication of your system, this usually means integrating the JWT authentication to your existing session authentication so that users automatically login to Tiny Drive and your system.
Don't forget you can look at the starter projects on Github to figure out how it works, even if your not familiar any of the languages we have for the starter packages, it may help you figure out how to go about it with your system.
Don't forget you can look at the starter projects on Github to figure out how it works, even if your not familiar any of the languages we have for the starter packages, it may help you figure out how to go about it with your system.
## Need help? ##
We recommend reading up and trying to understand how JWT works, you need some basic skills in order to implement Tiny Drive. This can be tricky, if you need some help, check our [help page](/tinydrive/get-help/) and if that doesn't work, contact our support.
@ -6,13 +6,13 @@ description: Guide on how to setup JWT Authentication for Tiny Drive
keywords: jwt authentication
---
## Audience
## Introduction
This section is intended to be used by developers with prior knowledge of [JSON Web Token](https://jwt.io/) (or JWT) in detail, including how they can be used for user authentication and session management in a web application. There will be some coding involved on both the client-side and the server-side to configure JWT as per the instructions in this section.
Tiny Drive require you to setup JWT authentication. This is to ensure that the security of your files remain in your control.
## Introduction
JWT is a common authorization solution for web services and is documented in more detail at the [https://jwt.io/](https://jwt.io/) website. The guide aims to show how to setup JWT authentication for Tiny Drive.
Tiny Drive require you to setup JWT authentication. This allows us to verify that you and your end user are allowed to access a particular feature. JWT is a common authorization solution for web services and is documented in more detail at the [https://jwt.io/](https://jwt.io/) website. The guide aims to show how to setup JWT authentication for Tiny Drive.
> If you haven't tried any of the [Starter projects]({{site.baseurl}}/tinydrive/getting-started/) yet, we urge you to try them before trying to implement your own solution. The source is also available on Github to study.
## Private/public key pair
@ -20,6 +20,8 @@ Tokens used by the TinyMCE cloud services make use of a public/private RSA key-p
The private/public key pair is created in your [Tiny account page](https://apps.tiny.cloud/my-account/jwt-key-manager/), but we only store the public key on our side. The private key is for you to store in your backend.
> Keep the private key secure, make sure you do not commit files containing the key to public repositories or similar!
## JWT provider URL
The easiest way to setup JWT authentication against TinyMCE cloud services is to create a JWT provider endpoint. This endpoint takes a JSON HTTP POST request and produces a JSON result with the token that the service will then use for all the HTTP requests.
@ -32,26 +34,34 @@ The following diagram explains the JWT call flow:
### Algorithm
The following algorithms are supported for the JWT header/signature:
* RS256
* RS384
* RS512
* PS256
* PS384
* PS512
All of these algorithms use the private RSA key to sign the JWT, but vary in how they execute. `RS256`, the most widely supported algorithm, features in following code examples.
Our examples use, and we recommend, RS256 algorithm. this is a list of supported ones: RS256, RS384, RS512, PS256, PS384, PS512
### Claims
These are like options/data you can send with the JWT token.
* **sub** - _(required)_ Unique string to identify the user. This can be a database ID, hashed email address, or similar identifier.
* **name** - _(required)_ Full name of the user that will be used for presentation inside Tiny Drive. When the user uploads a file, this name is presented as the creator of that file.
* **https://claims.tiny.cloud/drive/root** - (optional) Full path to a tiny drive specific root for example "/johndoe". The user won't be able to see or manage files outside this configured root path.
## PHP token provider example
## Step by step
Follow these steps in order to setup your own JWT endpoint.
This example uses the [Firebase JWT library](https://github.com/firebase/php-jwt) provided through the Composer dependency manager. The private key should be the private key that was generated through your Tiny Account. Each service requires different claims to be provided. The following example shows the sub and name claims needed for Tiny Drive.
1. Setup a JWT endpoint on your server, this could be a simple page using one of the examples below.
2. Configure the `tinydrive_token_provider` to that endpoint.
3. Make sure you copy the private key into the example code.
4. You should be good to go now.
> The JWT Endoint should examine your systems sessions in order to verify your user has access to your system.
## Need help?
We recommend reading up and trying to understand how JWT works, you need some basic skills in order to implement Tiny Drive. This can be tricky, if you need some help, check our [help page](/tinydrive/get-help/) and if that doesn't work, contact our support.
## PHP token provider endpoint example
This example uses the [Firebase JWT library](https://github.com/firebase/php-jwt) provided through the Composer dependency manager. The private key should be the private key that was generated through your Tiny Account.
### jwt.php ###
```php
<?php
@ -67,18 +77,16 @@ $privateKey = <<<EOD
-----END PRIVATE KEY-----
EOD;
$payload = array(
// Unique user id string
"sub" => "123",
// NOTE: Before you proceed with the TOKEN, verify your users session or access.
plugins: 'image media link tinydrive code imagetools',
tinydrive_token_provider: 'jwt.php',
toolbar: 'insertfile image link | code'
});
```
## Node token provider endpoint example
## Node token provider example
This example shows you how to set up a Node.js express handler that produces the tokens. It requires you to install the Express web framework and the `jsonwebtoken` Node modules.
This example shows you how to set up a Node.js express handler that produces the tokens. It requires you to install the Express web framework and the `jsonwebtoken` Node modules. Each service requires different claims to be provided. The following example shows the sub and name claims needed for Tiny Drive.
### /jwt
```js
const express = require('express');
@ -113,18 +132,15 @@ const privateKey = `
`;
app.post('/jwt', function (req, res) {
// NOTE: Before you proceed with the TOKEN, verify your users session or access.
@ -142,3 +158,18 @@ app.post('/jwt', function (req, res) {
app.listen(3000);
```
### TinyMCE example with /jwt endpoint
```
tinymce.init({
selector: 'textarea',
plugins: 'image media link tinydrive code imagetools',
tinydrive_token_provider: '/jwt',
toolbar: 'insertfile image link | code'
});
```
### More configuration
If you managed to set this up, you should be good to go with checking out the various [configuration options](/tinydrive/configuration/) for Tiny Drive and how you can customize is. Don't forget to change the JWT Claim's (user id, user name) to get those from your system.
If you need some help, check our [help page](/tinydrive/get-help/) and if that doesn't work, contact our support.
Tiny Drive allows you to manage your images and files in the cloud, when you are setup with your system, you will enjoy trouble free management of assets in the cloud.
Once Tiny Drive is setup, you will be able to drag and drop files to instantly upload them to cloud storage behind a blazing fast CDN helping you serve the files and images you need.
You will be able to drag and drop files to instantly upload them to cloud storage behind a blazing fast CDN helping you serve the files and images you need.
## Demo
@ -38,4 +38,6 @@ If you move or rename a file, it will still have the same unique URL, so the res
## User specific root
It's common that you want to be able to have user specific paths so that each user within your system gets it's own directory. This can be done by setting the `https://claims.tiny.cloud/drive/root` custom jwt claim to a path within your tiny drive account. This path will automatically be constructured when the user is accessing drive using a jwt key with that claim. The user only be able to see and manage files within that root.
It's common that you want to be able to have user specific paths so that each user within your system gets it's own directory. This can be done by setting the `https://claims.tiny.cloud/drive/root` custom JWT claim to a path within your tiny drive account. This path will automatically be constructured when the user is accessing drive using a JWT key with that claim. The user only be able to see and manage files within that root.
Continue to [getting started](/tinydrive/getting-started/) with Tiny Drive.