Can i use both grant_type=password and grant_type=authorization_code in same project for oauth2 in spring...












-1














Please do let me know, the situation is if I use Alexa, then our project should implement grant_type=authorization_code and when using our own mobile app we need grant_type=password, is this possible?










share|improve this question





























    -1














    Please do let me know, the situation is if I use Alexa, then our project should implement grant_type=authorization_code and when using our own mobile app we need grant_type=password, is this possible?










    share|improve this question



























      -1












      -1








      -1







      Please do let me know, the situation is if I use Alexa, then our project should implement grant_type=authorization_code and when using our own mobile app we need grant_type=password, is this possible?










      share|improve this question















      Please do let me know, the situation is if I use Alexa, then our project should implement grant_type=authorization_code and when using our own mobile app we need grant_type=password, is this possible?







      java spring-boot oauth-2.0






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited Nov 13 '18 at 9:09









      Andreas

      1,7741718




      1,7741718










      asked Nov 13 '18 at 8:37









      Utpala DebnathUtpala Debnath

      157




      157
























          1 Answer
          1






          active

          oldest

          votes


















          0














          Yes, you can.
          When you store clients, you assign them the allowed grant type (e.g. password, authorization_code).



          As an example, look at he following code:



          clients.inMemory()
          .withClient("my-trusted-client")
          .authorizedGrantTypes("password", "authorization_code", "refresh_token", "implicit")
          .authorities("ROLE_CLIENT", "ROLE_TRUSTED_CLIENT")
          .scopes("read", "write", "trust")
          .secret("secret")
          .accessTokenValiditySeconds(120).//Access token is only valid for 2 minutes.
          refreshTokenValiditySeconds(600);//Refresh token is only valid for 10 minutes.
          }


          The my-trusted-client client can either use password or authorization code.



          The snippet comes from this guide that I strongly suggest you to follow together with this one. Moreover, as a note, you should read the OAuth2 RFC. It is the best guide to understand the flow.






          share|improve this answer





















          • thna a lot, yup i tried including both in my project and both working fine independently, thnx
            – Utpala Debnath
            Nov 14 '18 at 5:56










          • If this is the solution to your problem, consider selecting the answer. Thanks. stackoverflow.com/help/accepted-answer
            – Tu.ma
            Nov 14 '18 at 8:11











          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%2f53276896%2fcan-i-use-both-grant-type-password-and-grant-type-authorization-code-in-same-pro%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














          Yes, you can.
          When you store clients, you assign them the allowed grant type (e.g. password, authorization_code).



          As an example, look at he following code:



          clients.inMemory()
          .withClient("my-trusted-client")
          .authorizedGrantTypes("password", "authorization_code", "refresh_token", "implicit")
          .authorities("ROLE_CLIENT", "ROLE_TRUSTED_CLIENT")
          .scopes("read", "write", "trust")
          .secret("secret")
          .accessTokenValiditySeconds(120).//Access token is only valid for 2 minutes.
          refreshTokenValiditySeconds(600);//Refresh token is only valid for 10 minutes.
          }


          The my-trusted-client client can either use password or authorization code.



          The snippet comes from this guide that I strongly suggest you to follow together with this one. Moreover, as a note, you should read the OAuth2 RFC. It is the best guide to understand the flow.






          share|improve this answer





















          • thna a lot, yup i tried including both in my project and both working fine independently, thnx
            – Utpala Debnath
            Nov 14 '18 at 5:56










          • If this is the solution to your problem, consider selecting the answer. Thanks. stackoverflow.com/help/accepted-answer
            – Tu.ma
            Nov 14 '18 at 8:11
















          0














          Yes, you can.
          When you store clients, you assign them the allowed grant type (e.g. password, authorization_code).



          As an example, look at he following code:



          clients.inMemory()
          .withClient("my-trusted-client")
          .authorizedGrantTypes("password", "authorization_code", "refresh_token", "implicit")
          .authorities("ROLE_CLIENT", "ROLE_TRUSTED_CLIENT")
          .scopes("read", "write", "trust")
          .secret("secret")
          .accessTokenValiditySeconds(120).//Access token is only valid for 2 minutes.
          refreshTokenValiditySeconds(600);//Refresh token is only valid for 10 minutes.
          }


          The my-trusted-client client can either use password or authorization code.



          The snippet comes from this guide that I strongly suggest you to follow together with this one. Moreover, as a note, you should read the OAuth2 RFC. It is the best guide to understand the flow.






          share|improve this answer





















          • thna a lot, yup i tried including both in my project and both working fine independently, thnx
            – Utpala Debnath
            Nov 14 '18 at 5:56










          • If this is the solution to your problem, consider selecting the answer. Thanks. stackoverflow.com/help/accepted-answer
            – Tu.ma
            Nov 14 '18 at 8:11














          0












          0








          0






          Yes, you can.
          When you store clients, you assign them the allowed grant type (e.g. password, authorization_code).



          As an example, look at he following code:



          clients.inMemory()
          .withClient("my-trusted-client")
          .authorizedGrantTypes("password", "authorization_code", "refresh_token", "implicit")
          .authorities("ROLE_CLIENT", "ROLE_TRUSTED_CLIENT")
          .scopes("read", "write", "trust")
          .secret("secret")
          .accessTokenValiditySeconds(120).//Access token is only valid for 2 minutes.
          refreshTokenValiditySeconds(600);//Refresh token is only valid for 10 minutes.
          }


          The my-trusted-client client can either use password or authorization code.



          The snippet comes from this guide that I strongly suggest you to follow together with this one. Moreover, as a note, you should read the OAuth2 RFC. It is the best guide to understand the flow.






          share|improve this answer












          Yes, you can.
          When you store clients, you assign them the allowed grant type (e.g. password, authorization_code).



          As an example, look at he following code:



          clients.inMemory()
          .withClient("my-trusted-client")
          .authorizedGrantTypes("password", "authorization_code", "refresh_token", "implicit")
          .authorities("ROLE_CLIENT", "ROLE_TRUSTED_CLIENT")
          .scopes("read", "write", "trust")
          .secret("secret")
          .accessTokenValiditySeconds(120).//Access token is only valid for 2 minutes.
          refreshTokenValiditySeconds(600);//Refresh token is only valid for 10 minutes.
          }


          The my-trusted-client client can either use password or authorization code.



          The snippet comes from this guide that I strongly suggest you to follow together with this one. Moreover, as a note, you should read the OAuth2 RFC. It is the best guide to understand the flow.







          share|improve this answer












          share|improve this answer



          share|improve this answer










          answered Nov 13 '18 at 10:41









          Tu.maTu.ma

          806219




          806219












          • thna a lot, yup i tried including both in my project and both working fine independently, thnx
            – Utpala Debnath
            Nov 14 '18 at 5:56










          • If this is the solution to your problem, consider selecting the answer. Thanks. stackoverflow.com/help/accepted-answer
            – Tu.ma
            Nov 14 '18 at 8:11


















          • thna a lot, yup i tried including both in my project and both working fine independently, thnx
            – Utpala Debnath
            Nov 14 '18 at 5:56










          • If this is the solution to your problem, consider selecting the answer. Thanks. stackoverflow.com/help/accepted-answer
            – Tu.ma
            Nov 14 '18 at 8:11
















          thna a lot, yup i tried including both in my project and both working fine independently, thnx
          – Utpala Debnath
          Nov 14 '18 at 5:56




          thna a lot, yup i tried including both in my project and both working fine independently, thnx
          – Utpala Debnath
          Nov 14 '18 at 5:56












          If this is the solution to your problem, consider selecting the answer. Thanks. stackoverflow.com/help/accepted-answer
          – Tu.ma
          Nov 14 '18 at 8:11




          If this is the solution to your problem, consider selecting the answer. Thanks. stackoverflow.com/help/accepted-answer
          – Tu.ma
          Nov 14 '18 at 8:11


















          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.





          Some of your past answers have not been well-received, and you're in danger of being blocked from answering.


          Please pay close attention to the following guidance:


          • 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%2f53276896%2fcan-i-use-both-grant-type-password-and-grant-type-authorization-code-in-same-pro%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

          Xamarin.iOS Cant Deploy on Iphone

          Glorious Revolution

          Dulmage-Mendelsohn matrix decomposition in Python