I am working on making mobile application backend apis. The api I am working on now is just getting user information. I am testing the api with Postman app.
When I call the api on the postman, it returns JSON data successfully, but sometimes it returns dummy data for same api call. And when I try again, it returns correct JSON data.
I am attaching two screens. Here is the issue:
Below shows correct response:
I am using Laravel5.1 and OAuth2 authentication module(lucadegasperi/oauth2-server-laravel) from Github. Server is hosted on Bluehost.
Here is laravel code:
/**
* Display a listing of the resource.
*
* @return \Illuminate\Http\Response
*/
public function index($id = null)
{
if($id == null) {
$my_id = Authorizer::getResourceOwnerId();
return User::find($my_id);
}
else
return User::find($id);
}
I am struggling with this issue for a week and please help me. Thanks in advance.