Add FAQ and modify create provider docs

Signed-off-by: Derrick Mehaffy <derrickmehaffy@gmail.com>
This commit is contained in:
Derrick Mehaffy 2020-03-02 00:09:46 -07:00
parent b6facf00c4
commit a70b55eeaf
No known key found for this signature in database
GPG Key ID: 5244F387D2FF3618
3 changed files with 83 additions and 26 deletions

View File

@ -265,6 +265,7 @@ module.exports = {
'Contributing guide',
],
'/3.0.0-beta.x/migration-guide/',
'/3.0.0-beta.x/faq',
],
},
],

54
docs/3.0.0-beta.x/faq.md Normal file
View File

@ -0,0 +1,54 @@
# Frequently Asked Questions
[[toc]]
## User can't login to the admin panel
With the release of the Strapi beta version a fundamental change occurred in that the "end-users" (REST and GraphQL users) were split from the Administrators (admin panel users) in such a way that normal users can not be given access to the admin panel. If you would like to read more on why this change was done, you can read the Strapi [blog post](https://strapi.io/blog/why-we-split-the-management-of-the-admin-users-and-end-users) about it.
In the future Strapi does plan to implement a solution where Administrators could use the REST and GraphQL routes like a standard 3rd party provider, but there is no intention of allowing for the reverse. Instead within Q1/Q2 2020 we plan to offer a plugin called [Administrators Roles & Permissions](https://portal.productboard.com/strapi/1-public-roadmap/c/8-administrators-roles-permissions) that will allow you to control access to Administrators within the admin panel. As of right now there is no work around to currently do this, anyone with access to the admin panel will have full access to all parts of it.
When this new plugin releases, there will be two versions:
- Community Edition
- Enterprise Edition
By default, the Community Edition will include 3 administrators and 3 pre-defined roles (Administrators, Editor, Author). Upgrading to the Enterprise Edition will unlock an unlimited numbers of administrators and roles.
## Relations aren't maintaining their sort order
With the components there is a hidden field called `order` that allows entries to maintain their sort, however with relations there is no such field. If you consider the typical count of of component entries vs relational based entries (in retrospect they function in the backend the same) there is generally a much higher number of relations. If relations were to have an `order` field applied to them as well it could cause significant performance degradation when trying to update the order, and likewise in the case where a relation could be attached to multiple entries it would be quite difficult to maintain the order.
For the time being there is no recommended way to handle this automatically and instead it may be required for you to create custom controllers to handle this within your own project.
## Why is my app's database resetting on Heroku
If you used `--quickstart` to create your Strapi project, by default this uses the SQLite database. Heroku's file system is [ephemeral](https://devcenter.heroku.com/articles/dynos#ephemeral-filesystem) meaning that each time a dyno (container) is reset all filesystem changes are lost. And since both SQLite and local uploads are stored on the filesystem, any changes made to these since the last dyno reset will be deleted. Typically dynos are reset at least once a day, and in most cases multiple times per day or when new code is pushed to Heroku.
It is recommended you use the Heroku PostgreSQL plugin or use something like MongoDB's Atlas for your database. For file uploads, you will need to use one of the 3rd party providers such as Cloudinary or AWS S3.
## How do I customize a plugin
Strapi uses a system called [extensions](./concepts/customization.md#plugin-extensions) as plugins are stored in the `node_modules` folder. Due to this extensions work by Strapi detecting newer versions of files and using that as a replacement for the ones stored within the `node_modules`. If you are familiar with React and "ejecting" a file, the concept is similar.
You gain the ability to modify these files without forking the plugin package, however you lose the ability to easily update. After each version release you will need to compare your changes to those in the new version and modify your version of the files accordingly.
## Can I add my own 3rd party auth provider
Yes you can either follow the following [guide](./plugins/users-permissions.md#adding-a-new-provider-to-your-project) or you can take a look at the [users-permissions](https://github.com/strapi/strapi/tree/master/packages/strapi-plugin-users-permissions) and submit a pull request to include the provider for everyone. Eventually Strapi does plan to move from the current grant/purest provider to a split natured system similar to the upload providers.
There is currently no ETA on this migration however.
## How do I setup SSL with Strapi
Strapi implements no SSL solution natively, this is due to the fact that it is extremely insecure to directly offer a Node.js application to the public web on a low port.
On Linux based operating systems you need root permissions to bind to any port below 1024 and with typical SSL being port 443 you would need to run your application as root.
Likewise since Strapi is Node.js based, in order for changes with the SSL certificate to take place (say when it expires) you would need to restart your application for that change to take effect.
Due to these two issues, it is recommended you use a proxy application such as Nginx, Apache, Traefik, or many others to handle your edge routing to Strapi. There are settings in the environment [server.json](./concepts/configurations.md#server) to handle upstream proxies. The proxy block requires all settings to be filled out and will modify any backend plugins such as authentication providers and the upload plugin to replace your standard `localhost:1337` with the proxy URL.
## Is X feature available yet
You can see the [ProductBoard roadmap](https://portal.productboard.com/strapi) to see which feature requests are currently being worked on and which have not.

View File

@ -132,7 +132,7 @@ axios
});
```
#### Providers
### Providers
Thanks to [Grant](https://github.com/simov/grant) and [Purest](https://github.com/simov/purest), you can easily use OAuth and OAuth2 providers to enable authentication in your application.
@ -144,7 +144,7 @@ In the following examples, the client app will be the [react login examples app]
::: tab GitHub
### Setup the server
#### Setup the server
Use `ngrok` to serve the frontend app.
@ -152,7 +152,7 @@ Use `ngrok` to serve the frontend app.
ngrok http 3000
```
### Github configuration
#### Github configuration
- Visit the OAuth Apps list page <br> [https://github.com/settings/developers](https://github.com/settings/developers)
- Click on **New OAuth App** button
@ -164,7 +164,7 @@ Then fill the informations:
- **Application description**: Strapi provider auth description
- **Authorization callback URL**: `https://65e60559.ngrok.io/connect/github`
### Strapi configuration
#### Strapi configuration
- Visit the User Permissions provider settings page <br> [http://localhost:1337/admin/plugins/users-permissions/providers](http://localhost:1337/admin/plugins/users-permissions/providers)
- Click on the **GitHub** provider
@ -180,7 +180,7 @@ Then fill the informations:
::: tab Facebook
### Setup the server
#### Setup the server
Use `ngrok` to serve the server app.
@ -188,7 +188,7 @@ Use `ngrok` to serve the server app.
ngrok http 1337
```
### Facebook configuration
#### Facebook configuration
- Visit the Developer Apps list page <br> [https://developers.facebook.com/apps/](https://developers.facebook.com/apps/)
- Click on **Add a New App** button
@ -205,7 +205,7 @@ To access the Application ID and secret:
- Click on **Settings** in the left menu
- Then on **Basic** link
### Strapi configuration
#### Strapi configuration
- Visit the User Permissions provider settings page <br> [http://localhost:1337/admin/plugins/users-permissions/providers](http://localhost:1337/admin/plugins/users-permissions/providers)
- Click on the **Facebook** provider
@ -221,7 +221,7 @@ Then fill the informations:
::: tab Google
### Google configuration
#### Google configuration
- Visit the Google Developer Console <br> [https://console.developers.google.com/](https://console.developers.google.com/)
- Click on the **Select a project** dropdown in the top menu
@ -248,7 +248,7 @@ To access the Client ID and secret:
- Click on **OAuth 2.0 Client IDs** name of the client you just created
### Strapi configuration
#### Strapi configuration
- Visit the User Permissions provider settings page <br> [http://localhost:1337/admin/plugins/users-permissions/providers](http://localhost:1337/admin/plugins/users-permissions/providers)
- Click on the **Google** provider
@ -264,7 +264,7 @@ Then fill the informations:
::: tab Twitter
### Setup the server
#### Setup the server
Use `ngrok` to serve the frontend app.
@ -272,7 +272,7 @@ Use `ngrok` to serve the frontend app.
ngrok http 3000
```
### Twitter configuration
#### Twitter configuration
- Visit the Apps list page <br> [https://developer.twitter.com/en/apps](https://developer.twitter.com/en/apps)
- Click on **Create an app** button
@ -289,7 +289,7 @@ To access the Consumer API keys:
- Click on **Keys and tokens** tab
### Strapi configuration
#### Strapi configuration
- Visit the User Permissions provider settings page <br> [http://localhost:1337/admin/plugins/users-permissions/providers](http://localhost:1337/admin/plugins/users-permissions/providers)
- Click on the **Twitter** provider
@ -305,7 +305,7 @@ Then fill the informations:
::: tab Discord
### Discord configuration
#### Discord configuration
- Visit the Apps list page on the developer portal <br> [https://discordapp.com/developers/applications/](https://discordapp.com/developers/applications/)
- Click on **New application** button
@ -318,7 +318,7 @@ To access the Consumer API keys:
- Click on **General information** in the left menu
### Strapi configuration
#### Strapi configuration
- Visit the User Permissions provider settings page <br> [http://localhost:1337/admin/plugins/users-permissions/providers](http://localhost:1337/admin/plugins/users-permissions/providers)
- Click on the **Discord** provider
@ -334,7 +334,7 @@ Then fill the informations:
::: tab Twitch
### Twitch configuration
#### Twitch configuration
- Visit the Apps list page on the developer console <br> [https://dev.twitch.tv/console/apps](https://dev.twitch.tv/console/apps)
- Click on **Register Your Application** button
@ -350,7 +350,7 @@ To access the Consumer API keys:
- Click on **Manage** button of your new app
- Then generate a new **Client Secret** with the **New Secret** button
### Strapi configuration
#### Strapi configuration
- Visit the User Permissions provider settings page <br> [http://localhost:1337/admin/plugins/users-permissions/providers](http://localhost:1337/admin/plugins/users-permissions/providers)
- Click on the **Twitch** provider
@ -366,7 +366,7 @@ Then fill the informations:
::: tab Instagram
### Setup the server
#### Setup the server
Use `ngrok` to serve the server app.
@ -374,7 +374,7 @@ Use `ngrok` to serve the server app.
ngrok http 1337
```
### Facebook configuration
#### Facebook configuration
- Visit the Developer Apps list page <br> [https://developers.facebook.com/apps/](https://developers.facebook.com/apps/)
- Click on **Add a New App** button
@ -393,7 +393,7 @@ On the **App Review for Instagram Basic Display** click on **Add to submition**
Make sure your Application information are well completed.
### Strapi configuration
#### Strapi configuration
- Visit the User Permissions provider settings page <br> [http://localhost:1337/admin/plugins/users-permissions/providers](http://localhost:1337/admin/plugins/users-permissions/providers)
- Click on the **Instagram** provider
@ -409,7 +409,7 @@ Then fill the informations:
::: tab VK
### VK configuration
#### VK configuration
- Visit the Apps list page <br> [https://vk.com/apps?act=manage](https://vk.com/apps?act=manage)
- Click on **Create app** button
@ -430,7 +430,7 @@ Then fill the informations:
- **Authorized redirect UR**: `http://localhost:1337/connect/vk/callback`
### Strapi configuration
#### Strapi configuration
- Visit the User Permissions provider settings page <br> [http://localhost:1337/admin/plugins/users-permissions/providers](http://localhost:1337/admin/plugins/users-permissions/providers)
- Click on the **VK** provider
@ -573,17 +573,19 @@ create: async ctx => {
};
```
## Adding a new provider (to the strapi project)
## Adding a new provider (to your project)
To add a new provider on Strapi, you will need to perform changes onto the following files:
```
packages/strapi-plugin-users-permissions/services/Providers.js
packages/strapi-plugin-users-permissions/config/functions/bootstrap.js
packages/strapi-plugin-users-permissions/admin/src/components/PopUpForm/index.js
packages/strapi-plugin-users-permissions/admin/src/translations/en.json
extensions/users-permissions/services/Providers.js
extensions/users-permissions/config/functions/bootstrap.js
extensions/users-permissions/admin/src/components/PopUpForm/index.js
extensions/users-permissions/admin/src/translations/en.json
```
If these files don't exist you will need to copy from your `node_modules` or the Strapi mono-repo. You can see the [plugin extensions](../concepts/customization.md#plugin-extensions) for more information as to how this works
We will go step by step.
### Configure your Provider Request