Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Keycloak email from gmail

Tags:

gmail

keycloak

I am trying setup Keycloak email with gmail. setup is easy, sample in this tutorial:

https://dev.to/rounakcodes/keycloak-configure-realm-email-settings-gmail-3dfn/

problem is with google settings, from May 30, 2022 google turn off Less secure apps what is necessary to connect gmail account with Keycloak (Keycloack is using only username and password to authorize gmail)

Maybe someone have idea how to workaround this problem? Same problem is with google workspace, right now it's working but They Are going to turn it off.

enter image description here

enter image description here

like image 301
Bartosz Kolej Avatar asked Nov 16 '25 03:11

Bartosz Kolej


2 Answers

try to generate App password https://myaccount.google.com/apppasswords and use it as SMTP password in "Email" configuration. It works for me on local build

I've found an answer here - https://groups.google.com/g/keycloak-user/c/PPtjMHJKwG0

like image 152
kramar Avatar answered Nov 17 '25 22:11

kramar


Since the less secure app feature is removed we have to follow these below steps to use Gmail via third party software that is App password

Step 1: setup 2-Step Verification:- Google Account -> Security -> 2-Step Verification -> Input password as asked -> Turn ON (you could use SMS to get Gmail code to activate 2-Step Verification)

Step 2: Generate app secret:- Google Account -> Security -> App password -> Input password as asked -> Select the app and device... -> e.g. Other(keycloak example) -> Input app name e.g. MyApp -> Generate

Step 3: Use generated app secret:- Copy a 16-character password Use a 16-character password (instead of actual password) with Gmail username in your application

This worked for me

like image 28
Deepak N Avatar answered Nov 17 '25 22:11

Deepak N



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!