
OAuth 2.0/OpenID Connect client SDK offering streamlined authorization code flow, token exchange and logout flows, with API compatibility with existing implementations and simple import/usage.
To install simply add to your common sourceset in the build gradle:
implementation("io.github.yet300:appauth-kotlin:0.1.2") Use the new package name in your imports:
import dev.yet300.appauth.*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")
}./gradlew clean build./gradlew test./gradlew ktlintCheckThis project is configured for deployment to Maven Central. See DEPLOYMENT.md for detailed instructions.
gradle.properties
./gradlew publishToOSSRHRepository
./gradlew ktlintCheck to ensure code qualityTo install simply add to your common sourceset in the build gradle:
implementation("io.github.yet300:appauth-kotlin:0.1.2") Use the new package name in your imports:
import dev.yet300.appauth.*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")
}./gradlew clean build./gradlew test./gradlew ktlintCheckThis project is configured for deployment to Maven Central. See DEPLOYMENT.md for detailed instructions.
gradle.properties
./gradlew publishToOSSRHRepository
./gradlew ktlintCheck to ensure code quality