strapi-azerothcore
v1.6.0
Published
AzerothCore integration for Strapi.
Downloads
9
Readme
Strapi AzerothCore plugin
AzerothCore integration in Strapi CMS.
✨ Features
- Multi-realm support out of the box
- Registration that also creates an in-game account with the same credentials
- Login with the same credentials as the in-game account
- Password reset and password change, which also change the in-game account password
- Account confirmation
- Linking of CMS accounts for existing in-game accounts
📋✔️ Requirements
- Node.js
- An AzerothCore server
- A working Strapi project, see the Quick Start Guide
🛠️ Installation
Install the plugin in your Strapi project:
# using npm
npm install strapi-azerothcore
# using yarn
yarn add strapi-azerothcore
Using a text/code editor, open config/plugins.js
(or config/plugins.ts
if applicable), add a "strapi-azerothcore"
object with an enabled
property set to true
:
module.exports = ({ env }) => ({
// ...
"strapi-azerothcore": {
enabled: true,
},
// ...
});
After installing the plugin, you must rebuild the admin dashboard for it to include the plugin.
Use the build
script to rebuild Strapi, or use develop
if you'd like to start it as well:
# using npm
npm run build
# or
npm run develop
# using yarn
yarn build
# or
yarn develop
The AzerothCore plugin should now appear in the left pane of your Strapi dashboard:
⚙️ Setup
General settings
In the leftmost pane of the Strapi dashboard, go to "AzerothCore", then "General" under the Settings category
- Allow linking existing game accounts
Check this to enable creating CMS user accounts for existing AzerothCore accounts. To use this feature, users will need to go through the registration process on your website and make sure to provide the account name and password they're using to log into the game server.
Realms settings
In the leftmost pane of the Strapi dashboard, go to "AzerothCore", then "Realms" under the Settings category
This is where you define your different realms.
Typically you need to have one entry for each row in the realmlist
table of your acore_auth
database.
You can click the "➕ Create realm" button on the top right corner of the page to add an entry, click one of the table's rows to edit an entry, or click the 🗑️ button on the right to delete an entry.
Each entry has the following settings:
Characters Database
- Host: the hostname on which your MySQL database server is running
- Port: the port on which your MySQL database server is listening, usually
3306
- Database: the name of the database, usually
acore_characters
- User: the MySQL user to connect with. Make sure that the user has access to the specified database.
- Password: the user's password
You can press the "🔌 Test Connection" button to ensure Strapi is able to connect to your database properly.
SOAP
- Host: the hostname on which your AzerothCore
worldserver
is running.
SeeSOAP.IP
in yourworldserver.conf
. - Port: the port on which your AzerothCore
worldserver
is listening for SOAP connections, usually7878
.
SeeSOAP.Port
in yourworldserver.conf
. - Username: the AzerothCore account name to connect with.
Make sure that the account has a security level of3
:- If you don't have an account for SOAP already, type this command in the
worldserver
console:account create soap mypassword
(changesoap
andmypassword
to your liking, they are the account name and password, respectively) - Change the security level to
3
for your SOAP account by typing this command in theworldserver
console:account set gmlevel soap 3 -1
(changesoap
to the name of your SOAP account) - See AzerothCore's wiki on account creation for more info
- If you don't have an account for SOAP already, type this command in the
- Password: the SOAP account's password
You can press the "🔌 Test Connection" button to ensure Strapi is able to connect to your AzerothCore server via SOAP properly.
Auth Database
In the leftmost pane of the Strapi dashboard, go to "AzerothCore", then "Auth Database" under the Settings category
- Host: the hostname on which your MySQL database server is running
- Port: the port on which your MySQL database server is listening, usually
3306
- Database: the name of the database, usually
acore_auth
- User: the MySQL user to connect with. Make sure that the user has access to the specified database.
- Password: the user's password
You can press the "🔌 Test Connection" button to ensure Strapi is able to connect to your database properly.
Permissions
In the leftmost pane of the Strapi dashboard, go to "AzerothCore", then "Permissions" under the Settings category
This page displays permission issues that would prevent standard usage of the AzerothCore plugin. Press the "🔨 Fix" button to fix the permissions.
Feel free to ignore the recommendations on this page if you know what you're doing and would like to disable some of the plugin's features via the permissions system.
Users & permissions plugin
In the leftmost pane of the Strapi dashboard, go to "⚙️ Settings", then visit the links under the "Users & permissions plugin" section:
Roles
This section allows you to manage which API endpoints are accessible for logged-in users ("Authenticated" role) and unauthenticated users ("Public" role).
Email templates
You can customize the emails sent to your users here.
Advanced settings
Make sure to change the "Reset password page" and "Redirection url" links:
- Reset password page: when using the "forgot password" feature, an email is sent with the specified URL. Make sure to input a link to an existing page of your frontend, which needs to call the
reset-password
API endpoint. - Enable email confirmation: enable this if you'd like the CMS to send a confirmation email when registering an account.
- Redirection url: when registering, a verification email is sent with a link that will redirect to the specified URL. Make sure to input a link to an existing page of your frontend, where you can notify the user that the account was successfully verified, for instance.
🔌 API endpoints
Your frontend can query the following API endpoints:
Auth
Register
POST/api/strapi-azerothcore/auth/register
{ "username": "myaccount", "email": "[email protected]", "password": "mypassword", "repeatPassword": "mypassword" }
Login
POST/api/strapi-azerothcore/auth/login
{ "identifier": "myaccount", "password": "mypassword" }
You can also use the email address to log in:
{ "identifier": "[email protected]", "password": "mypassword" }
Example response:
{ "jwt": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6NzMsImlhdCI6MTcxOTE1MTY0MiwiZXhwIjoxNzIxNzQzNjQyfQ.IoEBek2debDordaC0y1X_mlksjFPx_roi-BoJUeYfIg", "user": { "id": 73, "username": "myaccount", "email": "[email protected]", "provider": "local", "confirmed": true, "blocked": false, "createdAt": "2024-06-20T10:51:14.841Z", "updatedAt": "2024-06-20T10:51:14.841Z" } }
Use the provided
jwt
in theAuthorization
header (Authorization: Bearer <your jwt>
without the brackets) for the endpoints that need authentication.Forgot Password
POST/api/auth/forgot-password
This will send an email to the provided email address if a user is found. The email will contain a link with acode
as a query parameter (?code=xxxxx
) which is needed for thereset-password
endpoint.{ "email": "[email protected]" }
Reset Password
POST/api/strapi-azerothcore/auth/reset-password
{ "code": "xxxxxxxxxxxxxxxxxxxxxxx", "password": "mynewpassword", "passwordConfirmation": "mynewpassword" }
The
code
is from a link sent via email when using thereset-password
endpoint.password
is the new password to set, andpasswordConfirmation
must be the value of a "repeat password" field in the form on your frontend.Change Password
POST/api/strapi-azerothcore/auth/change-password
🔐 Requires authentication{ "currentPassword": "password", "password": "mynewpassword", "passwordConfirmation": "mynewpassword" }
Change Email
POST/api/strapi-azerothcore/auth/change-email
🔐 Requires authentication{ "email": "[email protected]" }
Characters
My Characters
GET/api/strapi-azerothcore/characters/:realmId/my-characters
🔐 Requires authentication
Returns data about the account's characters for a given realmMy Guilds
GET/api/strapi-azerothcore/characters/:realmId/my-guilds
🔐 Requires authentication
Returns data about the account's owned guilds for a given realm
Realms
- Realms
GET/api/strapi-azerothcore/realms
Returns data about the realms
User Activity
- User Activity
GET/api/strapi-azerothcore/user-activity
🔐 Requires authentication
💭 You can use query parameters to control sorting and paging
Returns data about activity for the account, such as logins, failed logins, password changes, etc.
🤝 Contributing
Contributions are greatly appreciated.
If you have a suggestion that would make this project better, feel free to fork the repository and create a Pull Request. You can also open a Feature Request.
⭐️ Show your support
⭐️ Give the project a star if you like it!
🔗 Links
🌎 Community support
- For general help using Strapi, please refer to the official Strapi documentation
- You can also get general help with Strapi on the Strapi Discord server
- You can get help for AzerothCore or this plugin on the AzerothCore Discord server
Prefer the#web
channel if you'd like to discuss this plugin - You can get in touch with me on Discord:
roboto_