Retrofit add header with token and id

前端 未结 2 1458
醉梦人生
醉梦人生 2021-02-04 17:14

I have a problem with getting authenticated user. Before it I got token and user id. Now i need to get user from server using access token and id. I have header format

2条回答
  •  谎友^
    谎友^ (楼主)
    2021-02-04 17:54

    I got it. It's must look like:

    @GET("driver/v1/driver")
    Call getAuthorizedDriver(@Header("authorization") String auth);
    

    And auth:

    Call call = apiInterface.getAuthorizedDriver("Token token=" + token + ", driver_id=" + id);
    

提交回复
热议问题