Skip to content

Keycloak Realm Email Settings for Gmail SMTP

Intro

Keycloak Realms requires email configuration to

  • verify email address of user
  • allow user to set own password

Steps

Assign email address to admin account

Use Keycloak Account Management to add email address in Personal Info
The below steps work for Keycloak 13 but UI may change with time

  • Login to Keycloak Security Admin Console using admin credentials
  • Click admin name shown in the top right corner
  • Click Manage account
  • Click Personal Info
  • Enter email address

Create an App Password inside your Google Account

Note: Google now requires that you have 2-Step-Verification enabled before you can set up an application password. App passwords let you sign in to your Google Account from apps on devices that don’t support 2-Step Verification like Keycloak. You’ll only need to enter it once so you don’t need to remember it.

  • Follow the steps in https://devanswers.co/create-application-specific-password-gmail/
  • The 16-character password is used later by your keycloak email setup
  • Just like your normal password, this app password grants complete access to your Google Account.
  • You won’t need to remember it, so don’t write it down or share it with anyone.
  • Configuration: Select App -> Custom -> Keycloak

Configure Keycloak Email Settings

  • Open your realm
  • Under Realm Settings > Email  the following details will work for a Gmail account
  • Host: smtp.gmail.com
  • Port: 465
  • From:  helmut.hutzler@gmail.com [ your gmail address }
  • Enable SSL : On
  • Enable Authentication: On
  • Username: helmut.hutzler
  • Password: YOUR-16-Byte-APP-PASSWORD ( see above configuration )

Press Test Connection button should return with sucdess and your gmail account should have rececived an email.

Reference

Published inKeycloak

Be First to Comment

Leave a Reply

Your email address will not be published. Required fields are marked *