Skip to content

Kirby email component to use OAuth2 Authentication (Gmail, Yahoo, Microsoft, Azure)

License

Notifications You must be signed in to change notification settings

nerdcel/kirby-oauth2-email

Repository files navigation

Kirby OAuth2 Email

Kirby 4+ Release License

This plugin is a Kirby extension that allows you to authenticate users via OAuth2 and their email address.

This plugin implements the OAuth2 flow for the following providers:

  • Google
  • Microsoft
  • Yahoo
  • Azure

Installation

composer require nerdcel/kirby-oauth2-email

Or download the latest release unzip it, copy it to site/plugins/kirby-oauth2-email.

Setup your OAuth2 provider

You need to configure your OAuth2 provider to allow the authentication of your users. You need to create an OAuth2 application and get the client ID and client secret. At this point, I assume you have a basic understanding of OAuth2 and how to setup your provider.

You most likely need to provide a redirect URL, which is https://your-site.tld/callback-path. If this step is done, you can configure the plugin using the refresh token, client ID, and client secret (tenantId e.g. Azure). Once this is done you can configure the plugin.

Usage

Edit your config.php and add the following lines:

'nerdcel.kirby-oauth2-email' => [
    'callback-path' => 'callback-path', // default: 'email/oauth2'
    'enabled' => true, // default: false
    'email' => '[email protected]',
    'service' => 'azure', // google, microsoft, yahoo, azure
    'client-id' => 'your-client-id',
    'client-secret' => 'your-client-secret',
    'tenant-id' => 'your-tenant-id', // only for azure
    'refresh-token' => 'your-refresh-token', // received from the first login
]

After you have configured the plugin, you should be able to send emails for example using the dreamform plugin or when you use the 2FA option for the panel.

Usefull links