nabedi
nabedi

Reputation: 11

Android laravel passport

I am trying to retrieve the token from the laravel passport but no response, this my code..

login

    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","[email protected]");
            params.put("password","anu12345");
            return params;
        }
    };
}

thanks

Upvotes: 1

Views: 507

Answers (1)

ibitebyt3s
ibitebyt3s

Reputation: 3022

Quite too late but still is a possible solution. I think that the problem is the URL. According to your root URL, you should ask for an access token to http://10.96.2.159/oauth/token.

Upvotes: 1

Related Questions