
Integrates AppAuth for streamlined authentication in projects, supporting common source use across various platforms. Offers an API similar to the OpenID AppAuth Android for easy adoption.
To install simply add to your common sourceset in the build gradle
implementation("dev.gitlive:appauth-kotlin:0.0.1")Perform a gradle refresh and you should then be able to import the app auth files.
val config = AuthorizationServiceConfiguration(
authorizationEndpoint = "https://endpoint/oauth/authorize",
tokenEndpoint = "https://endpoint/oauth/token",
endSessionEndpoint = "https://endpoint/oauth/logout"
)
val request = AuthorizationRequest(
config,
"CLIENT_ID",
listOf("openid", "profile", "member"),
"code",
"callback://oauth/callback"
)
try {
val response = authorizationService.performAuthorizationRequest(request)
tokenRequest.emit(response.createTokenExchangeRequest())
} catch (exception: AuthorizationException) {
println("User attempted to cancel login")
}To install simply add to your common sourceset in the build gradle
implementation("dev.gitlive:appauth-kotlin:0.0.1")Perform a gradle refresh and you should then be able to import the app auth files.
val config = AuthorizationServiceConfiguration(
authorizationEndpoint = "https://endpoint/oauth/authorize",
tokenEndpoint = "https://endpoint/oauth/token",
endSessionEndpoint = "https://endpoint/oauth/logout"
)
val request = AuthorizationRequest(
config,
"CLIENT_ID",
listOf("openid", "profile", "member"),
"code",
"callback://oauth/callback"
)
try {
val response = authorizationService.performAuthorizationRequest(request)
tokenRequest.emit(response.createTokenExchangeRequest())
} catch (exception: AuthorizationException) {
println("User attempted to cancel login")
}