Android laravel护照

时间:2017-01-16 10:11:31

标签: php android laravel laravel-5.3

我正在尝试从laravel护照中检索令牌但没有回复,这是我的代码..

登录

    public void getToken(){

    final String url = "http://10.96.2.159/chat/public/oauth/token";

    StringRequest str = new StringRequest(Request.Method.POST, url,
            new Response.Listener<String>() {
                @Override
                public void onResponse(String response) {
                    msgResponse.setText("Work!");
                }
            }
            , new Response.ErrorListener() {
        @Override
        public void onErrorResponse(VolleyError error) {

        }
    }){
        @Override
        protected Map<String, String> getParams() throws AuthFailureError {
            Map<String,String> params = new HashMap<String, String>();
            params.put("client_id","2");
            params.put("client_secret","token");
            params.put("grant_type","password");
            params.put("username","user1@tracer.com");
            params.put("password","anu12345");
            return params;
        }
    };
}

感谢

1 个答案:

答案 0 :(得分:0)

太晚了,但仍然是一个可能的解决方案。我认为问题是URL。根据您的根URL,您应该要求访问令牌http://10.96.2.159/oauth/token