mirror of
https://github.com/apognu/otter
synced 2025-02-17 11:20:34 +01:00
Create the OAuth2 app with the correct scopes.
This commit is contained in:
parent
93af0e416e
commit
ced4dc67af
@ -23,7 +23,7 @@ fun AuthState.save() {
|
|||||||
object OAuth {
|
object OAuth {
|
||||||
data class App(val client_id: String, val client_secret: String)
|
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 {
|
fun state(): AuthState = PowerPreference.getFileByName(AppContext.PREFS_CREDENTIALS).getString("state").run {
|
||||||
AuthState.jsonDeserialize(this)
|
AuthState.jsonDeserialize(this)
|
||||||
@ -38,8 +38,9 @@ object OAuth {
|
|||||||
fun register(context: Context, callback: () -> Unit) {
|
fun register(context: Context, callback: () -> Unit) {
|
||||||
state().authorizationServiceConfiguration?.let { config ->
|
state().authorizationServiceConfiguration?.let { config ->
|
||||||
val body = mapOf(
|
val body = mapOf(
|
||||||
"name" to UUID.randomUUID(),
|
"name" to "Otter - ${UUID.randomUUID()}",
|
||||||
"redirect_uris" to REDIRECT_URI.toString()
|
"redirect_uris" to REDIRECT_URI.toString(),
|
||||||
|
"scopes" to "read write"
|
||||||
)
|
)
|
||||||
|
|
||||||
runBlocking {
|
runBlocking {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user