title: Best way host own sso Oauth2 service for web / native applications using Spring
body: <p>I want: </p>
  
  <ul>
  <li>central oauth2 server which will hold all user accounts and will provide platform for user account management</li>
  <li>multiple services which will connect to central oauth2 server to verify user. Each service will have Web and mobile applications (iOS, Android)</li>
  </ul>
  
  <p>I followed <a href="https://spring.io/guides/tutorials/spring-boot-oauth2/" rel="nofollow noreferrer">spring-boot-oauth tutorial</a> and have client that connects to server for credentials using redirect. This works fine for browsers, but I wish to be able to login directly in native apps. I think using grant_type=password should solve the problem, but I can not find good description how to approach this. </p>
  
  <ol>
  <li>Should I send token request directly to central server for refresh token, or should I proxy it through each application service?</li>
  <li>Is there any way to check on native app if user is already logged in central server from device, or do I always need to send login/password? I'm aware that I could <a href="https://aaronparecki.com/oauth-2-simplified/#mobile-apps" rel="nofollow noreferrer">develop separate application to which I will redirect user for verification</a>, but for user-experience and time-efficient reasons I would like to avoid it. </li>
  </ol>