Retrofit 2.0 headers authentication

前端 未结 1 991
陌清茗
陌清茗 2021-02-14 20:43
private void setUpRestClient() {
       OkHttpClient client = new OkHttpClient();
       client.interceptors().add(new Interceptor() {
           @Override
           pu         


        
1条回答
  •  梦如初夏
    2021-02-14 21:04

    You can pass Authorization Header as:

    @GET("/v1/OrderReport.json")
    Call getExampleMethod(@Header("Authorization") String token, @Query("id") String id);
    

    and then call as:

    getExampleMethod("Basic " + token, id);
    

    0 讨论(0)
提交回复
热议问题