php-github-api
php-github-api copied to clipboard
RequestInterface shows invalid URI
I'm, always getting the "Not found"
error on my api calls. Tried investigating and found this on the $request passed to the RequestInterface::sendRequest()
method:
Request {#346 ▼
-method: "GET"
-requestTarget: null
-uri: Uri {#347 ▼
-scheme: ""
-userInfo: ""
-host: ""
-port: null
-path: "/user/repos"
-query: "type=owner&sort=full_name&direction=asc"
-fragment: ""
}
-headers: []
-headerNames: []
-protocol: "1.1"
-stream: null
}
Seems like the path
parameter is missing some parameters even though $github->currentUser()->show()
shows a complete response:
array:30 [▼
"login" => "myusername"
"id" => xxxxxxxxx
"avatar_url" => "https://avatars2.githubusercontent.com/u/xxxxxxxxx?v=3"
"gravatar_id" => ""
"url" => "https://api.github.com/users/myusername"
"html_url" => "https://github.com/myusername"
"followers_url" => "https://api.github.com/users/myusername/followers"
"following_url" => "https://api.github.com/users/myusername/following{/other_user}"
"gists_url" => "https://api.github.com/users/myusername/gists{/gist_id}"
"starred_url" => "https://api.github.com/users/myusername/starred{/owner}{/repo}"
"subscriptions_url" => "https://api.github.com/users/myusername/subscriptions"
"organizations_url" => "https://api.github.com/users/myusername/orgs"
"repos_url" => "https://api.github.com/users/myusername/repos"
"events_url" => "https://api.github.com/users/myusername/events{/privacy}"
"received_events_url" => "https://api.github.com/users/myusername/received_events"
"type" => "User"
"site_admin" => false
"name" => "My Name"
"company" => null
"blog" => "http://www.myusername.com"
"location" => null
"email" => "[email protected]"
"hireable" => true
"bio" => null
"public_repos" => 4
"public_gists" => 0
"followers" => 0
"following" => 0
"created_at" => "2013-03-05T03:52:44Z"
"updated_at" => "2017-06-28T06:59:13Z"
]
@jhourlad can you show us the code on how you create the client?
The code that generates the user token:
$user = Socialite::driver('github')->user();
The authentication codes I use:
$github = new Client();
$github->authenticate($user->token, null, Client::AUTH_HTTP_TOKEN);