Is it possible to add more than one email per user in Keycloak?











up vote
0
down vote

favorite












I'm using Keycloak for Identity Brokering through Google, Microsoft, etc. But Keycloak only allows one email per user. So the user can be authenticated only through one of the social login options (Google if gmail is added as user's email address, etc.). Is there any way to include more than one email per user, or any other workaround?



EDIT: (Editing based on comments to make scenario more clear)



In my scenario, I'm using a federated user store which contains a large number of users and and I need Keycloak to access all the emails linked to a user when that user is logging in using Google,Azure,etc. because Keycloak is using the email as the unique identifier for the authentication response from the social login provider. Without having the required email as the main email, Keycloak won't allow that user to log in through social IdP










share|improve this question




























    up vote
    0
    down vote

    favorite












    I'm using Keycloak for Identity Brokering through Google, Microsoft, etc. But Keycloak only allows one email per user. So the user can be authenticated only through one of the social login options (Google if gmail is added as user's email address, etc.). Is there any way to include more than one email per user, or any other workaround?



    EDIT: (Editing based on comments to make scenario more clear)



    In my scenario, I'm using a federated user store which contains a large number of users and and I need Keycloak to access all the emails linked to a user when that user is logging in using Google,Azure,etc. because Keycloak is using the email as the unique identifier for the authentication response from the social login provider. Without having the required email as the main email, Keycloak won't allow that user to log in through social IdP










    share|improve this question


























      up vote
      0
      down vote

      favorite









      up vote
      0
      down vote

      favorite











      I'm using Keycloak for Identity Brokering through Google, Microsoft, etc. But Keycloak only allows one email per user. So the user can be authenticated only through one of the social login options (Google if gmail is added as user's email address, etc.). Is there any way to include more than one email per user, or any other workaround?



      EDIT: (Editing based on comments to make scenario more clear)



      In my scenario, I'm using a federated user store which contains a large number of users and and I need Keycloak to access all the emails linked to a user when that user is logging in using Google,Azure,etc. because Keycloak is using the email as the unique identifier for the authentication response from the social login provider. Without having the required email as the main email, Keycloak won't allow that user to log in through social IdP










      share|improve this question















      I'm using Keycloak for Identity Brokering through Google, Microsoft, etc. But Keycloak only allows one email per user. So the user can be authenticated only through one of the social login options (Google if gmail is added as user's email address, etc.). Is there any way to include more than one email per user, or any other workaround?



      EDIT: (Editing based on comments to make scenario more clear)



      In my scenario, I'm using a federated user store which contains a large number of users and and I need Keycloak to access all the emails linked to a user when that user is logging in using Google,Azure,etc. because Keycloak is using the email as the unique identifier for the authentication response from the social login provider. Without having the required email as the main email, Keycloak won't allow that user to log in through social IdP







      keycloak






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited yesterday









      tryingToLearn

      2,32922546




      2,32922546










      asked Nov 7 at 9:03









      RakihthaRR

      577




      577
























          1 Answer
          1






          active

          oldest

          votes

















          up vote
          1
          down vote













          Although, Keycloak emphasises on keeping a unique email,but there are certain scenarios where you may want to keep , say, secondary email.



          This can be achieved in a couple of steps:



          1. Add a custom attribute for secondary email in user like this:



          enter image description here



          2. Next , in your client create attribute mapper like this:



          enter image description here



          When I generated the token after above configuration, the new attribute was avialble in token. You can use this attribute in your app as you desire.



          Parsed JWT:



          enter image description here






          share|improve this answer





















          • Thanks. But in my scenario, I'm using a federated user store which contains a large number of users and and I need Keycloak to access all the emails linked to a user when that user is logging in using Google,Azure,etc. because Keycloak is using the email as the unique identifier for the authentication response from the social login provider. Without having the required email as the main email, Keycloak won't allow that user to log in through social IdP.
            – RakihthaRR
            yesterday











          Your Answer






          StackExchange.ifUsing("editor", function () {
          StackExchange.using("externalEditor", function () {
          StackExchange.using("snippets", function () {
          StackExchange.snippets.init();
          });
          });
          }, "code-snippets");

          StackExchange.ready(function() {
          var channelOptions = {
          tags: "".split(" "),
          id: "1"
          };
          initTagRenderer("".split(" "), "".split(" "), channelOptions);

          StackExchange.using("externalEditor", function() {
          // Have to fire editor after snippets, if snippets enabled
          if (StackExchange.settings.snippets.snippetsEnabled) {
          StackExchange.using("snippets", function() {
          createEditor();
          });
          }
          else {
          createEditor();
          }
          });

          function createEditor() {
          StackExchange.prepareEditor({
          heartbeatType: 'answer',
          convertImagesToLinks: true,
          noModals: true,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: 10,
          bindNavPrevention: true,
          postfix: "",
          imageUploader: {
          brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
          contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
          allowUrls: true
          },
          onDemand: true,
          discardSelector: ".discard-answer"
          ,immediatelyShowMarkdownHelp:true
          });


          }
          });














           

          draft saved


          draft discarded


















          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53186273%2fis-it-possible-to-add-more-than-one-email-per-user-in-keycloak%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown

























          1 Answer
          1






          active

          oldest

          votes








          1 Answer
          1






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes








          up vote
          1
          down vote













          Although, Keycloak emphasises on keeping a unique email,but there are certain scenarios where you may want to keep , say, secondary email.



          This can be achieved in a couple of steps:



          1. Add a custom attribute for secondary email in user like this:



          enter image description here



          2. Next , in your client create attribute mapper like this:



          enter image description here



          When I generated the token after above configuration, the new attribute was avialble in token. You can use this attribute in your app as you desire.



          Parsed JWT:



          enter image description here






          share|improve this answer





















          • Thanks. But in my scenario, I'm using a federated user store which contains a large number of users and and I need Keycloak to access all the emails linked to a user when that user is logging in using Google,Azure,etc. because Keycloak is using the email as the unique identifier for the authentication response from the social login provider. Without having the required email as the main email, Keycloak won't allow that user to log in through social IdP.
            – RakihthaRR
            yesterday















          up vote
          1
          down vote













          Although, Keycloak emphasises on keeping a unique email,but there are certain scenarios where you may want to keep , say, secondary email.



          This can be achieved in a couple of steps:



          1. Add a custom attribute for secondary email in user like this:



          enter image description here



          2. Next , in your client create attribute mapper like this:



          enter image description here



          When I generated the token after above configuration, the new attribute was avialble in token. You can use this attribute in your app as you desire.



          Parsed JWT:



          enter image description here






          share|improve this answer





















          • Thanks. But in my scenario, I'm using a federated user store which contains a large number of users and and I need Keycloak to access all the emails linked to a user when that user is logging in using Google,Azure,etc. because Keycloak is using the email as the unique identifier for the authentication response from the social login provider. Without having the required email as the main email, Keycloak won't allow that user to log in through social IdP.
            – RakihthaRR
            yesterday













          up vote
          1
          down vote










          up vote
          1
          down vote









          Although, Keycloak emphasises on keeping a unique email,but there are certain scenarios where you may want to keep , say, secondary email.



          This can be achieved in a couple of steps:



          1. Add a custom attribute for secondary email in user like this:



          enter image description here



          2. Next , in your client create attribute mapper like this:



          enter image description here



          When I generated the token after above configuration, the new attribute was avialble in token. You can use this attribute in your app as you desire.



          Parsed JWT:



          enter image description here






          share|improve this answer












          Although, Keycloak emphasises on keeping a unique email,but there are certain scenarios where you may want to keep , say, secondary email.



          This can be achieved in a couple of steps:



          1. Add a custom attribute for secondary email in user like this:



          enter image description here



          2. Next , in your client create attribute mapper like this:



          enter image description here



          When I generated the token after above configuration, the new attribute was avialble in token. You can use this attribute in your app as you desire.



          Parsed JWT:



          enter image description here







          share|improve this answer












          share|improve this answer



          share|improve this answer










          answered yesterday









          tryingToLearn

          2,32922546




          2,32922546












          • Thanks. But in my scenario, I'm using a federated user store which contains a large number of users and and I need Keycloak to access all the emails linked to a user when that user is logging in using Google,Azure,etc. because Keycloak is using the email as the unique identifier for the authentication response from the social login provider. Without having the required email as the main email, Keycloak won't allow that user to log in through social IdP.
            – RakihthaRR
            yesterday


















          • Thanks. But in my scenario, I'm using a federated user store which contains a large number of users and and I need Keycloak to access all the emails linked to a user when that user is logging in using Google,Azure,etc. because Keycloak is using the email as the unique identifier for the authentication response from the social login provider. Without having the required email as the main email, Keycloak won't allow that user to log in through social IdP.
            – RakihthaRR
            yesterday
















          Thanks. But in my scenario, I'm using a federated user store which contains a large number of users and and I need Keycloak to access all the emails linked to a user when that user is logging in using Google,Azure,etc. because Keycloak is using the email as the unique identifier for the authentication response from the social login provider. Without having the required email as the main email, Keycloak won't allow that user to log in through social IdP.
          – RakihthaRR
          yesterday




          Thanks. But in my scenario, I'm using a federated user store which contains a large number of users and and I need Keycloak to access all the emails linked to a user when that user is logging in using Google,Azure,etc. because Keycloak is using the email as the unique identifier for the authentication response from the social login provider. Without having the required email as the main email, Keycloak won't allow that user to log in through social IdP.
          – RakihthaRR
          yesterday


















           

          draft saved


          draft discarded



















































           


          draft saved


          draft discarded














          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53186273%2fis-it-possible-to-add-more-than-one-email-per-user-in-keycloak%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown





















































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown

































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown







          這個網誌中的熱門文章

          Tangent Lines Diagram Along Smooth Curve

          Yusuf al-Mu'taman ibn Hud

          Zucchini