Retrofit 2.0 headers authentication

前端 未结 1 990
陌清茗
陌清茗 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<POJO_Class> getExampleMethod(@Header("Authorization") String token, @Query("id") String id);
    

    and then call as:

    getExampleMethod("Basic " + token, id);
    
    0 讨论(0)
提交回复
热议问题