https://github.com/gitliveapp/appauth-kotlin
https://github.com/gitliveapp/appauth-kotlin
Last synced: 4 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/gitliveapp/appauth-kotlin
- Owner: GitLiveApp
- License: apache-2.0
- Created: 2022-11-21T10:21:54.000Z (over 2 years ago)
- Default Branch: main
- Last Pushed: 2022-12-13T16:50:53.000Z (over 2 years ago)
- Last Synced: 2025-01-07T17:19:01.827Z (6 months ago)
- Language: Kotlin
- Size: 148 KB
- Stars: 1
- Watchers: 2
- Forks: 2
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# AppAuth-Kotlin
AppAuth-Kotlin
![]()
![]()
![]()
Built and maintained with 🧡 by GitLive
Real-time code collaboration inside any IDE
The AppAuth-Kotlin SDK is a Kotlin-first SDK for AppAuth. It's API is similar to the Open ID AppAuth Android but also supports multiplatform projects, enabling you to use AppAuth directly from your common source targeting iOS, Android or JS.## Installation
To install simply add to your common sourceset in the build gradle
```kotlin
implementation("dev.gitlive:appauth-kotlin:0.0.1")
```Perform a gradle refresh and you should then be able to import the app auth files.
## Useage
```kotlin
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")
}
```