title: E/Error: retrofit2.adapter.rxjava2.HttpException: HTTP 401 Unauthorized in kotlin android
body: <p>This is the response i am trying to fetch from the api </p>
  
  <pre><code>{
      "success": {
          "id": 35,
          "otp": 9830,
          "msg": "Otp has sent on this number"
      }
  }
  </code></pre>
  
  <p>The response is working absolutely fine when checked in postman . However when i try to fetch the same json by parsing the response in Hashmap format in android kotlin i get the  E/Error: retrofit2.adapter.rxjava2.HttpException: HTTP 401 Unauthorized</p>
  
  <p>Now This is My android rxjava kotlin code as below where i am passing all necessery parameters but the response goes to error block. The code is as follows</p>
  
  <pre><code>override fun login(api_token: String, name: String, mobile: String, lat: String, lon: String, address: String) {
  
        var subscribe = api.login(api_token,mobile.toInt(),lat.toDouble(),lon.toDouble(),address).subscribeOn(Schedulers.io())
                  .observeOn(AndroidSchedulers.mainThread())
                  .subscribe({ list: LoginParentResponseModel? -&gt;
                      Log.i("login",list!!.toString())
                      view.showProgress(false)
                      view.loadLoginSuccess(list!!.success)
                  }, { error -&gt;
                      view.loadLoginFailure("loginfailed")
                      view.showProgress(false)
                      view.showErrorMessage("problen"+error.toString())
  
  
                  })
          subscriptions.add(subscribe)
  
  
  }
  </code></pre>
  
  <p>Now this is the Model class for reponse handling </p>
  
  <pre><code>data class LoginParentResponseModel(val success : Map&lt;String,String&gt;,val error : Map&lt;String,String&gt;)
  </code></pre>
  
  <p>Now this is the api and its parameters which is fine as like i am using in postman </p>
  
  <pre><code>@FormUrlEncoded
      @POST("api/register?")
      fun login(@Field("api_token") id: String, @Field("mobile") mobile: Int,@Field("lat") lat: Double,@Field("lon") lon: Double,@Field("address") address: String): Observable&lt;LoginParentResponseModel&gt;
  </code></pre>
  
  <p>Please help me to resolve this issue. Your help would be much appreciated. Thanks in advance</p>