Search code examples
androidwear-osandroid-wear-2.0android-signing

Android Wear Sign In


I have a standalone Android Wear app which has a login for in it but I'm finding the process really difficult. I don't want to create a mobile module in my app to request email and password from the user. I also found this which I think explains kinda what I want to do but it doesn't guide me at all.

Do you guys know a way to request email and password from users on their phone without creating a mobile module?


Solution

  • The Sign in on the phone flow is available for OAuth 2.0 apps as per the documentation:

    Wear provides OAuth 2.0 support for third-party apps to authenticate a user with a web service. Considering the limited screen real estate on wear devices, Wear OS OAuth support enables standalone watch apps to complete the OAuth authentication flow via a phone. Standalone apps use a request and response URL model to authenticate a user and receive an OAuth token to access the service.

    This is done by using the OAuthClient and sendAuthorizationRequest() to open up a WebView on the phone to your OAuth page. The Wear OAuth sample provides a full example of how this works.