Minimum supported Android SDK is Android SDK 21 (Android 5.0 Lollipop)
./gradlew build
-
Set up Kinde environment
-
Open Kinde settings in the Kinde Admin area.
-
Navigate to
App keyssection -
Add urls for callback and logout:
au.kinde://<your kinde url>//kinde_callbackFor example:
au.kinde://coolapp.kinde.com/kinde_callback
-
-
Setup Android project
- Add meta-data to
<application>section of yourAndroidManifest.xml, for example:-
Kinde domain (Token host):
<meta-data android:name="au.kinde.domain" android:value="coolapp.kinde.com" /> -
Client ID:
<meta-data android:name="au.kinde.clientId" android:value="12usan9gwef901bsdf09basd" /> -
Audience (Optional):
<meta-data android:name="au.kinde.audience" android:value="example@example" />
-
- Add meta-data to
-
Build the application by calling
./gradlew buildfrom the root directory of the starter kit
To get instance of SDK just instantiate KindeSDK (See KindeSDK) class with activity (See AppCompatActivity) and sdkListener (See SDKListener)
Optionally list of scopes can be provided to override default list.
##How to authorize
-
With PKCE
- call
loginfunction of SDK withgrantTypeparameter set toGrantType.PKCE(See GrantType class for available options)
- call
-
Without PKCE
- call
loginfunction of SDK without parameters or withgrantTypeparameter set toGrantType.NONE(See GrantType class for available options)
- call
login and register functions allow org_code parameter if there is need to sign in or sign up to a specific org
SDK provides all available API methods as functions: just call one of functions to get data or pass information to server.
In case request is failed, null will be returned and additional information would be passed as exception to onException method of SDKListener See How to initialize section.
Supported exceptions:
WrongThreadException. Thrown if API method is called from main (UI) threadNotAuthorizedException. Thrown if API method is called beforelogin, so there is no token yetException. Thrown if API request is failed. Http response code and message will be passed
NOTE: Functions/methods targeting the Management API can only be accessed with tokens generated by the Client Credentials Auth flow at the moment. Since this SDK does not support the Client Credential flow, Management API functions are not available for use. In the future, tokens obtained via other flows would also be able to access the management API functions/methods.
SDK provides set of helper functions that allows to retrieve additional information:
- User Details
- call
getUserDetailsfunction of SDK. If the ID token is present UserDetails object filled with data will be returned
- call
- Claim
- call
getClaimfunction of SDK. Required parameter:claimto specify claim that should be retrieved. Optionally type of token can be chosen See TokenType. If claim is present in chosen token String with data will be returned. Otherwisenull
- call
- Permissions
- call
getPermissionsfunction of SDK. Returnspermissionsclaim from access token ClaimData
- call
- Permission
- call
getPermissionfunction of SDK. Required parameter:permissionto specify permission that should be checked. ReturnsisGrantedflag for requested permission ClaimData
- call
- Permissions
- call
getOrganizationfunction of SDK. Returnsorg_codeclaim from access token ClaimData
- call
- Permission
- call
getUserOrganizationsfunction of SDK. Returnsorg_codesclaim from access token ClaimData
- call
- Authenticated state
- call
isAuthenticatedfunction of SDK. Returnstrueif accessToken is present and has valid signature
- call