1

令牌响应的格式

Yandeks.OAuth 以 JSON 格式返回令牌和他的生命时间:

200 OK
Content-type: application/json

{
  "access_token": "5fd980a5133b4887a8937fe07d3a0a60",
  "token_type": "bearer",
  "expires_in": 124234123534
}

接口 OAuthServerIntf.class:

@FormUrlEncoded
@POST("authorize?response_type=token")
Call<OAuthTokenYandex> requestTokenForm1(
         @Field("client_id") String client_id
);

但是buider,不是这样吗?错误json

@NonNull
    public static OAuthServerIntf yandexBuilder() {
        //Using Default HttpClient
        Retrofit retrofit = new Retrofit.Builder()
                .addConverterFactory(MoshiConverterFactory.create())
                .baseUrl("https://oauth.yandex.ru/")
                .build();
        OAuthServerIntf webServer = retrofit.create(OAuthServerIntf.class);
        return webServer;
    }

日志:

java.io.IOException: Use JsonReader.setLenient(true) to accept malformed JSON at path $
4

0 回答 0