How do I structure authentication with a social IdP?












0















My system works as follows;



I have an ASP.Net RESTful API server, which contains a user database.
I also have a Xamarin.Forms application, with a registration and login page.



What I want is to have the ability to authenticate a login using a social IdP, and then, if that user has not been logged in before, register that user in my local database.



I have been reading up on how to implement OAuth 2.0 with OpenID Connect to authenticate my users with a social IdP, however, I cannot seem to wrap my head arround it. From what I've read, I shouldn't use an Access token for authentication, since that i what the ID token is for, however, I have also read that the only intended purpose for an ID token, is the client.



My problem then is, how can I make sure that calls made to my ASP.Net server, has been made by "real person", and how do I determine who makes the call?










share|improve this question



























    0















    My system works as follows;



    I have an ASP.Net RESTful API server, which contains a user database.
    I also have a Xamarin.Forms application, with a registration and login page.



    What I want is to have the ability to authenticate a login using a social IdP, and then, if that user has not been logged in before, register that user in my local database.



    I have been reading up on how to implement OAuth 2.0 with OpenID Connect to authenticate my users with a social IdP, however, I cannot seem to wrap my head arround it. From what I've read, I shouldn't use an Access token for authentication, since that i what the ID token is for, however, I have also read that the only intended purpose for an ID token, is the client.



    My problem then is, how can I make sure that calls made to my ASP.Net server, has been made by "real person", and how do I determine who makes the call?










    share|improve this question

























      0












      0








      0








      My system works as follows;



      I have an ASP.Net RESTful API server, which contains a user database.
      I also have a Xamarin.Forms application, with a registration and login page.



      What I want is to have the ability to authenticate a login using a social IdP, and then, if that user has not been logged in before, register that user in my local database.



      I have been reading up on how to implement OAuth 2.0 with OpenID Connect to authenticate my users with a social IdP, however, I cannot seem to wrap my head arround it. From what I've read, I shouldn't use an Access token for authentication, since that i what the ID token is for, however, I have also read that the only intended purpose for an ID token, is the client.



      My problem then is, how can I make sure that calls made to my ASP.Net server, has been made by "real person", and how do I determine who makes the call?










      share|improve this question














      My system works as follows;



      I have an ASP.Net RESTful API server, which contains a user database.
      I also have a Xamarin.Forms application, with a registration and login page.



      What I want is to have the ability to authenticate a login using a social IdP, and then, if that user has not been logged in before, register that user in my local database.



      I have been reading up on how to implement OAuth 2.0 with OpenID Connect to authenticate my users with a social IdP, however, I cannot seem to wrap my head arround it. From what I've read, I shouldn't use an Access token for authentication, since that i what the ID token is for, however, I have also read that the only intended purpose for an ID token, is the client.



      My problem then is, how can I make sure that calls made to my ASP.Net server, has been made by "real person", and how do I determine who makes the call?







      asp.net xamarin.forms oauth-2.0 openid-connect






      share|improve this question













      share|improve this question











      share|improve this question




      share|improve this question










      asked Nov 14 '18 at 10:02









      NeebzNeebz

      92




      92
























          1 Answer
          1






          active

          oldest

          votes


















          0














          Access token will be used determine whether the client application was authorized by a user to access a resource. The concept of ID token comes from OpenID Connect. Main purpose of the ID token is to authenticate the user to the client application (i.e. letting the client application know that the person who authorized the access is a valid person).



          To do this, you have to validate the ID token. This can be done using third party libraries such as nimbusds or auth0. You can validate the signature of the token verify the integrity of the token and check the claims included in the token (by comparing them with expected values) to verify the user details. Also, you can add custom claims (any claim that is specific for your application/implementation) to the tokens through your identity provider so that you'll be able to validate those particular claims in order to verify the user.






          share|improve this answer
























          • Allright, so when I have validated the user at the login stage, how do I do the rest of my calls, for example a call to GET groups? Will I then keep parsing the ID token to verify the user's authenticity, or should I create my own "session token" which I give the user at the login? I'm guessing it would be quite unsafe not to require continous authentication thoughout the use of the app?

            – Neebz
            Nov 14 '18 at 12:55











          • Allocating a session token for the user would be a good idea, I suppose. But if you want, you can keep parsing the ID token to verify claims at each step. But keep in mind that the overhead for decoding and validating over and over would be high.

            – RakihthaRR
            Nov 15 '18 at 4:07











          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',
          autoActivateHeartbeat: false,
          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%2f53297500%2fhow-do-i-structure-authentication-with-a-social-idp%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









          0














          Access token will be used determine whether the client application was authorized by a user to access a resource. The concept of ID token comes from OpenID Connect. Main purpose of the ID token is to authenticate the user to the client application (i.e. letting the client application know that the person who authorized the access is a valid person).



          To do this, you have to validate the ID token. This can be done using third party libraries such as nimbusds or auth0. You can validate the signature of the token verify the integrity of the token and check the claims included in the token (by comparing them with expected values) to verify the user details. Also, you can add custom claims (any claim that is specific for your application/implementation) to the tokens through your identity provider so that you'll be able to validate those particular claims in order to verify the user.






          share|improve this answer
























          • Allright, so when I have validated the user at the login stage, how do I do the rest of my calls, for example a call to GET groups? Will I then keep parsing the ID token to verify the user's authenticity, or should I create my own "session token" which I give the user at the login? I'm guessing it would be quite unsafe not to require continous authentication thoughout the use of the app?

            – Neebz
            Nov 14 '18 at 12:55











          • Allocating a session token for the user would be a good idea, I suppose. But if you want, you can keep parsing the ID token to verify claims at each step. But keep in mind that the overhead for decoding and validating over and over would be high.

            – RakihthaRR
            Nov 15 '18 at 4:07
















          0














          Access token will be used determine whether the client application was authorized by a user to access a resource. The concept of ID token comes from OpenID Connect. Main purpose of the ID token is to authenticate the user to the client application (i.e. letting the client application know that the person who authorized the access is a valid person).



          To do this, you have to validate the ID token. This can be done using third party libraries such as nimbusds or auth0. You can validate the signature of the token verify the integrity of the token and check the claims included in the token (by comparing them with expected values) to verify the user details. Also, you can add custom claims (any claim that is specific for your application/implementation) to the tokens through your identity provider so that you'll be able to validate those particular claims in order to verify the user.






          share|improve this answer
























          • Allright, so when I have validated the user at the login stage, how do I do the rest of my calls, for example a call to GET groups? Will I then keep parsing the ID token to verify the user's authenticity, or should I create my own "session token" which I give the user at the login? I'm guessing it would be quite unsafe not to require continous authentication thoughout the use of the app?

            – Neebz
            Nov 14 '18 at 12:55











          • Allocating a session token for the user would be a good idea, I suppose. But if you want, you can keep parsing the ID token to verify claims at each step. But keep in mind that the overhead for decoding and validating over and over would be high.

            – RakihthaRR
            Nov 15 '18 at 4:07














          0












          0








          0







          Access token will be used determine whether the client application was authorized by a user to access a resource. The concept of ID token comes from OpenID Connect. Main purpose of the ID token is to authenticate the user to the client application (i.e. letting the client application know that the person who authorized the access is a valid person).



          To do this, you have to validate the ID token. This can be done using third party libraries such as nimbusds or auth0. You can validate the signature of the token verify the integrity of the token and check the claims included in the token (by comparing them with expected values) to verify the user details. Also, you can add custom claims (any claim that is specific for your application/implementation) to the tokens through your identity provider so that you'll be able to validate those particular claims in order to verify the user.






          share|improve this answer













          Access token will be used determine whether the client application was authorized by a user to access a resource. The concept of ID token comes from OpenID Connect. Main purpose of the ID token is to authenticate the user to the client application (i.e. letting the client application know that the person who authorized the access is a valid person).



          To do this, you have to validate the ID token. This can be done using third party libraries such as nimbusds or auth0. You can validate the signature of the token verify the integrity of the token and check the claims included in the token (by comparing them with expected values) to verify the user details. Also, you can add custom claims (any claim that is specific for your application/implementation) to the tokens through your identity provider so that you'll be able to validate those particular claims in order to verify the user.







          share|improve this answer












          share|improve this answer



          share|improve this answer










          answered Nov 14 '18 at 11:18









          RakihthaRRRakihthaRR

          185111




          185111













          • Allright, so when I have validated the user at the login stage, how do I do the rest of my calls, for example a call to GET groups? Will I then keep parsing the ID token to verify the user's authenticity, or should I create my own "session token" which I give the user at the login? I'm guessing it would be quite unsafe not to require continous authentication thoughout the use of the app?

            – Neebz
            Nov 14 '18 at 12:55











          • Allocating a session token for the user would be a good idea, I suppose. But if you want, you can keep parsing the ID token to verify claims at each step. But keep in mind that the overhead for decoding and validating over and over would be high.

            – RakihthaRR
            Nov 15 '18 at 4:07



















          • Allright, so when I have validated the user at the login stage, how do I do the rest of my calls, for example a call to GET groups? Will I then keep parsing the ID token to verify the user's authenticity, or should I create my own "session token" which I give the user at the login? I'm guessing it would be quite unsafe not to require continous authentication thoughout the use of the app?

            – Neebz
            Nov 14 '18 at 12:55











          • Allocating a session token for the user would be a good idea, I suppose. But if you want, you can keep parsing the ID token to verify claims at each step. But keep in mind that the overhead for decoding and validating over and over would be high.

            – RakihthaRR
            Nov 15 '18 at 4:07

















          Allright, so when I have validated the user at the login stage, how do I do the rest of my calls, for example a call to GET groups? Will I then keep parsing the ID token to verify the user's authenticity, or should I create my own "session token" which I give the user at the login? I'm guessing it would be quite unsafe not to require continous authentication thoughout the use of the app?

          – Neebz
          Nov 14 '18 at 12:55





          Allright, so when I have validated the user at the login stage, how do I do the rest of my calls, for example a call to GET groups? Will I then keep parsing the ID token to verify the user's authenticity, or should I create my own "session token" which I give the user at the login? I'm guessing it would be quite unsafe not to require continous authentication thoughout the use of the app?

          – Neebz
          Nov 14 '18 at 12:55













          Allocating a session token for the user would be a good idea, I suppose. But if you want, you can keep parsing the ID token to verify claims at each step. But keep in mind that the overhead for decoding and validating over and over would be high.

          – RakihthaRR
          Nov 15 '18 at 4:07





          Allocating a session token for the user would be a good idea, I suppose. But if you want, you can keep parsing the ID token to verify claims at each step. But keep in mind that the overhead for decoding and validating over and over would be high.

          – RakihthaRR
          Nov 15 '18 at 4:07


















          draft saved

          draft discarded




















































          Thanks for contributing an answer to Stack Overflow!


          • Please be sure to answer the question. Provide details and share your research!

          But avoid



          • Asking for help, clarification, or responding to other answers.

          • Making statements based on opinion; back them up with references or personal experience.


          To learn more, see our tips on writing great answers.




          draft saved


          draft discarded














          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53297500%2fhow-do-i-structure-authentication-with-a-social-idp%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







          Popular posts from this blog

          Bressuire

          Vorschmack

          Quarantine