This application showcases using the Mobile Identity Connect (MIC) authorization-grant login flow from Kinvey's client libraries.
Mobile Identity Connect is a service that bridges mobile applications with existing enterprise identity and single sign-on solutions. MIC enables mobile applications to integrate with a variety of identity solutions using a single OAuth2-based interface. This allows enterprise application developers to avoid the complexity of integrating these protocols into mobile, while providing enterprise IT the means to ensure that access to resources is secured only to authenticated users, as well as maintaining full control over a mobile user's identity.
##Set up
- Clone the Repo, or download the zip file and extract it.
- Download the latest Kinvey library (zip) and extract the downloaded zip file, from: http://devcenter.kinvey.com/android/downloads
###Console
- Visit the User Section of the console.
- Click the Auth Source tab at the top of the page
- Set the
Type of Provider
to beCustom
- In the
Provider URL
, enter:https://authlinkdemo.herokuapp.com/authenticate
- In the
Redirect URI's:
enter:kinveyAuthDemo://
The above Auth Provider sample can be used with the username: test
and the password: test
.
###Android Studio
- In Android Studio, go to File → New → Import Project
- Browse to the extracted zip from step 1, and click OK
- Click Next and Finish.
- Copy all jars in the libs/ folder of the Kinvey Android library zip to the lib/ folder at the root of the project
- Click the play button to start a build, if you still see compilation errors ensure the versions are correctly defined in the dependencies list
###Finally, for all IDEs
Specify your app key and secret in MainActivity
constant variables APP_KEY and APP_SECRET. Specify your redirect URI in redirectURI, and the username and password you want to use for the automated flow.
public class MainActivity extends ActionBarActivity {
private Client kinveyClient;
private static final String APP_KEY = "APP_KEY";
private static final String APP_SECRET = "APP_SECRET";
private static final String redirectURI = "REDIRECT_URI";
private static final String USERNAME = "USERNAME";
private static final String PASSWORD = "PASSWORD";
In your AndroidManifest.xml
, specify your redirect URI in all lowercase letters without the trailing characters-- for example, "MyRedirect://" would be entered as "myredirect"
<data android:scheme="RedirectURI" />
Take a look at our MIC Guide for more information.