Login Page
July 23, 2015

The Mobile SDK includes a complete Login activity. Currently, you must use the default SCiO login screen with your application.

Login Android app


When using an app created with the SCiO Mobile SDK, after the end user logs in for the first time, an access token is saved on the user’s mobile device. As the access token does not have an expiry date the end user will not need to login again.

The following code example demonstrates how to activate the SCiO login activity, get the access token, and save it on the user’s mobile device:

ScioCloud scioCloud = new ScioCloud(this);

/* Checks whether the mobile device has an access token. If no access token exists, SCiO’s login activity is activated. */
if (!scioCloud.hasAccessToken()) {
   Intent intent = new Intent(this, ScioLoginActivity.class);

    /* In order to activate the Login activity, supply the following parameters: 
    RedirectURL: Defined in the SCiO Developer Portal
    ApplicationId: received from the SCiO Developer Portal when registering the app. 

   intent.putExtra(ScioLoginActivity.INTENT_REDIRECT_URI, "http://your.redirect.url");
   // Start the login activity 
   startActivityForResult(intent, requestCode);

On successful login, onActivityResult is called with the requestCode supplied.


protected void onActivityResult(int requestCode, int resultCode, final Intent data) {
   super.onActivityResult(requestCode, resultCode, data);

   switch (requestCode) {
           if (resultCode == RESULT_OK) {
               Log.d(TAG, "We are logged in.");
           else {
               runOnUiThread(new Runnable() {
                   public void run() {
                       final String description = data.getStringExtra(ScioLoginActivity.ERROR_DESCRIPTION);
                       final int errorCode = data.getIntExtra(ScioLoginActivity.ERROR_CODE, -1);

                       Toast.makeText(MainActivity.this, "An error has occurred.\nError code: " + errorCode + "\nDescription: " + description, Toast.LENGTH_LONG).show();



The access token is removed using the ScioCloud.deleteAccessToken. Once the access token is deleted , the user will need to log in to the SCiO App again.

Leave a Reply