Pre-requisites to Setup Mobile App
  • 20 Jun 2023
  • 1 Minute to read
  • Dark
    Light
  • PDF

Pre-requisites to Setup Mobile App

  • Dark
    Light
  • PDF

Article summary

There are two pre-requisites:

  1. You need to make code-level changes in your application. An SDK(Software Development Kit) will be provided by Cross Identity.
  2.  While installing the application on your mobile, give the required permission. 

Follow the steps to make the modifications to your mobile application:

Add libraries  

  1. Download the <.arr> SDK file and copy it to your project. 
  2. Open the build.gradle file. 
  3. Add the below dependencies:    
    implementation files('path/*.aar') implementation
    "androidx.security:security-crypto:1.1.0-alpha06" implementation
    'com.google.code.gson:gson:2.9.0'// gson implementation
    'com.squareup.retrofit2:converter-gson:2.9.0'// Retrofit implementation
    'com.squareup.okhttp3:logging-interceptor:4.9.3'//http implementation
    'com.squareup.okhttp3:okhttp:4.9.3' 
  4. Open the existing local.properties located in /gradle and add the following values for these parameters as shown:CLIENT_ID: Enter the Client Identifier from the application configuration tab while onboarding the Native App SSO
    Example: CLIENT_ID="gunRLrIjIu3Le8yeUhQV"
    REDIRECTION_URL: Enter com.first.sample:/callback as the value, which is what you defined as the Sign-in redirect URI in the Native app application configuration tab.
    Example: REDIRECTION_URL="crossidentity\://callback"
    GRANT_TYPE: "authorization_code": The Authorization Code grant type is used by confidential and public clients to exchange an authorization code for an access token
    Example: GRANT_TYPE="authorization_code"
    BASE_URL: Enter your Cross Identity base url.
    Example: BASE_URL="https\://mss-poc.crossidentity.com/"
    SCOPE: scopes provide a way to limit the amount of access that is granted to an access token for Native Application SSO.
    Example: SCOPE="openid email device_sso"
    STATE: The state parameter is used to protect against XSRF. Your application generates a random string and sends it to the authorization server using the state parameter.
    STATE=" "
  5. After all the changes then sync the project.
  6. Run the application, LibraryCheckActivity will show the following options:
    Authenticate: For authentication, we pass the param as “4”, which will start the authentication process. btn_authenticate.setOnClickListener { startActivityForResult( Intent(this, LibMainActivity::class.java).putExtra("for", 4), 
    103 
    )  } 
    Logout: For Logout, we pass the param as “2”, which will start the Logout process. btn_logout.setOnClickListener {         startActivityForResult(
                 Intent(this, LibDashboard::class.java).putExtra("for", 2),
                103
            )
        }

    Exchange Token: For Exchange Token, we pass the param as “3”, which will start Exchange
    Token process.
    btn_exchange.setOnClickListener {         startActivityForResult(
                 Intent(this, LibDashboard::class.java).putExtra("for", 3),
                103
            ) }

    Introspect: For Introspect, we pass the param as “1”, which will start Introspect process. btn_introspect.setOnClickListener {         startActivityForResult(
                 Intent(this, LibDashboard::class.java).putExtra("for", 1),
                103
            )     } 
  7. To handle the response Onactivity Result, the following response request combinations are used. 
ResultNumber
Logout Success100
Failed111
Exchange Success101
Failed112
Introspect Success102
Failed113
Authentication Success103
Failed114

Was this article helpful?