Что за формат запроса?
Подскажите что за формат запроса:
grant_type=password&client_id=2&client_secret=xxxxxxxxxxxxxxxxxxxxxxx&[email protected]&password=password&scope=*,
Сейчас отправляю этим способом и получаю следующее:
@Headers("Content-Type: application/x-www-form-urlencoded")
@POST("oauth/token")
fun getUserAuthorizationToken(@Body userAuthorizationRequest: UserAuthorizationRequest): Observable<TokenResponse>
Где userAuthorizationRequest- Data Class:
data class UserAuthorizationRequest(
val grant_type: String = "password",
val client_id: Long = 2,
val client_secret: String = "xxxxxxxxxxxxxxxxxxxxxxx",
val username: String? = null,
val password: String? = null,
val scope: String = "*"
)
Результат:
{"client_id":8,"client_secret":"vc3ZzOrNzRPf55Ebkgd6cyYnRHF8Jj0YgBN6v1lG","grant_type":"password","password":"Getdata1","scope":"*","username":"[email protected]"}
Пробовал еще вот таким вот вариантом, но он не отработал так, как мне нужно:
@FormUrlEncoded
@Headers("Content-Type: application/x-www-form-urlencoded")
@POST("oauth/token")
fun getUserAuthorizationToken(
@Field("client_id") clientId: Int,
@Field("client_secret") clientSecret: String,
@Field("grant_type") grantType: String,
@Field("password") password: String,
@Field("scope") scope: String,
@Field("username") username: String
): Observable<TokenResponse>
Результат:
client_id=8&client_secret=xxxxxxxxxxxxxxxxxxx=password&password=Password1&scope=*&username=example%40example.com
Где я оступился, что я сделал не так? Буду очень благодарен за помощь.