From ced4dc67af426074715582574797022742e6d644 Mon Sep 17 00:00:00 2001 From: Antoine POPINEAU Date: Thu, 3 Sep 2020 15:40:56 +0200 Subject: [PATCH] Create the OAuth2 app with the correct scopes. --- app/src/main/java/com/github/apognu/otter/utils/OAuth.kt | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/app/src/main/java/com/github/apognu/otter/utils/OAuth.kt b/app/src/main/java/com/github/apognu/otter/utils/OAuth.kt index a57d62d..bb343e9 100644 --- a/app/src/main/java/com/github/apognu/otter/utils/OAuth.kt +++ b/app/src/main/java/com/github/apognu/otter/utils/OAuth.kt @@ -23,7 +23,7 @@ fun AuthState.save() { object OAuth { data class App(val client_id: String, val client_secret: String) - val REDIRECT_URI = Uri.parse("urn:/com.github.apognu.otter/oauth/callback") + private val REDIRECT_URI = Uri.parse("urn:/com.github.apognu.otter/oauth/callback") fun state(): AuthState = PowerPreference.getFileByName(AppContext.PREFS_CREDENTIALS).getString("state").run { AuthState.jsonDeserialize(this) @@ -38,8 +38,9 @@ object OAuth { fun register(context: Context, callback: () -> Unit) { state().authorizationServiceConfiguration?.let { config -> val body = mapOf( - "name" to UUID.randomUUID(), - "redirect_uris" to REDIRECT_URI.toString() + "name" to "Otter - ${UUID.randomUUID()}", + "redirect_uris" to REDIRECT_URI.toString(), + "scopes" to "read write" ) runBlocking {