The login flow is a standard OAuth 2.0 Access Token flow using the browser. When a user clicks on a login button, the browser is opened using an Intent created by the app and the user is presented with the Nike Plus login page. The user enters their Nike credentials and success or failure is returned to the app in the form of a browser redirect. If authentication is successful, the Intent fired by the browser is handled by the application to exchange the authorization code for an access token. The SDK provides functions to handle this flow.
The application must be configured to handle the redirect URL Intent that will be fired after the web based login is complete.
The next step is to initiate the login flow by calling the SDK. Pass a NikeConfig object and the application context to the Nike login method.
After the user has completed the web authentication flow, the browser will fire an Intent containing the auth code information. This intent can be passed to the SDK, and the SDK will exchange the auth code for an access token. A handler is notified of success or failure. The handler is required to conform to the NikeLoginHandler interface.
After the SDK has successfully exchanged the authorization code for a token, the Credential object contains the access token, refresh token and related information. This object is available from NikeFacade.getCredential. Leveraging the Nike+ Android SDK is the preferred method, as there is a lot of work put into making hte login flow the best experience for the app and the user, but the API the Nike+ Android SDK uses is available. Please refer to the code level documentation for details.