Email Verification #

Pragma Engine offers the Email Sender Plugin which can be used to send an email to players for email verification. We currently support Brevo (formerly Sendinblue) and creation of a custom Email Sender Plugin for any email provider of your choice. To use the Email Sender Plugin you’ll need to do the following:

  1. Configure the Email Sender Plugin in your Pragma Engine config.
  2. Configure the verificationEmailEndpoint that is defined in the Account service config.
For email platforms besides Brevo, see the Create a custom Email Sender Plugin section below.

Flow overview #

Below is an example demonstrating how a player can verify their email:

  1. The player adds or updates their email in Player Portal which calls the updateEmailV1 endpoint.
  2. The Email Sender Plugin sends a verification email to the player that contains the email verification link.
  3. After the player clicks on the link in the verification email they are redirected to a new page. That page calls verifyEmailV1 to verify their email and then the player is redirected back to the Player Portal.
    • The link in the verification email can be configured in the Account service config verificationEmailEndpoint; this config is set to the Player Portal by default (http://127.0.0.1:11000/#/verify-email).
  4. There are two possible scenarios that are dependent on whether the player is logged in to the Player Portal:
    • Players who are already logged in are directed to their Settings page and have the word verified appear next to their email.
    • Players who are not logged in are directed to the Player Portal login page. After logging in the player will then open into their Settings page and have the word verified appear next to their email.

Configure the Email Sender Plugin #

Pragma Engine offers a pre-implemented Email Sender Plugin for Brevo (formerly Sendinblue).

Below is an example of how to configure the SendInBlueEmailSenderPlugin:

social:
  pluginConfigs:
    AccountService.emailSenderPlugin:
      class: "pragma.account.SendInBlueEmailSenderPlugin"
      config:
        providerAPIKey: "encrypted-provider-api-key"
        apiUrl: "https://api.sendinblue.com/"
        route: "v3/smtp/email"
        verificationTemplateId: "sendinblue-email-template-id"
        fromEmail: "noreply@yourcompany.com"
        fromName: "Your Company NoReply"

Custom Email Sender Plugin #

To send a verification email to a player from a custom email service, implement the Email Sender Plugin interface:

/**
 * Plugin used to send emails. Normally used to send a verification email address email.
 */
interface EmailSenderPlugin {
    /**
     * Sends a verification email address email.
     *
     * Used by
     * - AccountService.updateEmailV1
     *
     */
    @ExperimentalCoroutinesApi
    suspend fun sendVerificationEmail(
        recipient: String, 
        verificationEmailEndpoint: String, 
        uniqueCode: String
    ): EmailMessageSent
}
After creating your custom Email Sender Plugin, you’ll need to configure the plugin in your Pragma Engine config.

Email verification expiration #

The verificationEmailEndpoint is the URL the player must visit to verify their email address. To configure the verificationEmailEndpoint you’ll need to update it under the Account service config:

social:
  serviceConfigs:
    AccountServiceConfig:
      verificationEmailEndpoint: "http://127.0.0.1:11000/#/verify-email"

This URL has an expiration time that is set in the TokenConfig.emailTokenExpirationMinutes config; the expiration time is set to 7 days by default.

social:
  serviceConfigs:
    TokenConfig:
      emailTokenExpirationMinutes: 10080

View email verification status #

Players can view their email verification status by calling AccountRpc.GetAccountV1Request. In addition, the status is viewable in the Player Portal on the Settings page.