Skip to content

Commit

Permalink
Merge pull request #254 from RADAR-base/revert-253-oura-personal-token
Browse files Browse the repository at this point in the history
Revert "Updated getExternalId function for Oura Oauth"
  • Loading branch information
mpgxvii authored Jan 25, 2024
2 parents 1851692 + 3785562 commit 4243cbb
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -55,9 +55,9 @@ data class OuraAuthUserId(
val age: Int,
val weight: Float,
val height: Float,
val biological_sex: String,
val gender: String,
val email: String,
@SerialName("id") val userId: String,
@SerialName("user_id") val userId: String,
)

data class SignRequestParams(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,8 @@ import io.ktor.client.call.body
import io.ktor.client.request.basicAuth
import io.ktor.client.request.forms.submitForm
import io.ktor.client.request.get
import io.ktor.client.request.headers
import io.ktor.client.request.url
import io.ktor.client.statement.bodyAsText
import io.ktor.http.HttpHeaders
import io.ktor.http.isSuccess
import io.ktor.http.takeFrom
import jakarta.ws.rs.core.Context
Expand Down Expand Up @@ -79,9 +77,9 @@ class OuraAuthorizationService(
private suspend fun getExternalId(accessToken: String): String = withContext(Dispatchers.IO) {
try {
val response = httpClient.get {
url(OURA_USER_ID_ENDPOINT)
headers {
append(HttpHeaders.Authorization, "Bearer $accessToken")
url {
takeFrom(OURA_USER_ID_ENDPOINT)
parameters.append("access_token", accessToken)
}
}
if (response.status.isSuccess()) {
Expand All @@ -101,6 +99,6 @@ class OuraAuthorizationService(
}

companion object {
private const val OURA_USER_ID_ENDPOINT = "https://api.ouraring.com/v2/usercollection/personal_info"
private const val OURA_USER_ID_ENDPOINT = "https://api.ouraring.com/v1/userinfo"
}
}

0 comments on commit 4243cbb

Please sign in to comment.