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 keys
section -
Add urls for callback and logout:
au.kinde://<your kinde url>//kinde_callback
For 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 build
from 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
login
function of SDK withgrantType
parameter set toGrantType.PKCE
(See GrantType class for available options)
- call
-
Without PKCE
- call
login
function of SDK without parameters or withgrantType
parameter 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
getUserDetails
function of SDK. If the ID token is present UserDetails object filled with data will be returned
- call
- Claim
- call
getClaim
function of SDK. Required parameter:claim
to 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
getPermissions
function of SDK. Returnspermissions
claim from access token ClaimData
- call
- Permission
- call
getPermission
function of SDK. Required parameter:permission
to specify permission that should be checked. ReturnsisGranted
flag for requested permission ClaimData
- call
- Permissions
- call
getOrganization
function of SDK. Returnsorg_code
claim from access token ClaimData
- call
- Permission
- call
getUserOrganizations
function of SDK. Returnsorg_codes
claim from access token ClaimData
- call
- Authenticated state
- call
isAuthenticated
function of SDK. Returnstrue
if accessToken is present and has valid signature
- call