Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
188 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
<?php | ||
|
||
namespace Tests\Feature; | ||
|
||
use Illuminate\Foundation\Testing\RefreshDatabase; | ||
use Illuminate\Foundation\Testing\WithFaker; | ||
use Tests\TestCase; | ||
|
||
class UpworkTest extends TestCase | ||
{ | ||
/** | ||
* A basic feature test example. | ||
*/ | ||
public function test_connects(): void | ||
{ | ||
$config = new \Upwork\API\Config( | ||
array( | ||
'clientId' => env("UPWORK_KEY"), // SETUP YOUR CONSUMER KEY | ||
'clientSecret' => env("UPWORK_SECRET"), // SETUP KEY SECRET | ||
//'grantType' => 'client_credentials', // used in Client Credentials Grant | ||
'redirectUri' => 'https://e538b8057c8e.ngrok.app/api/upwork/callback', // used in Code Authorization Grant | ||
//'accessToken' => null, // WARNING: keep this up-to-date! | ||
//'refreshToken' => null, // WARNING: keep this up-to-date! // NOT needed for Client Credentials Grant | ||
//'expiresIn' => null, // WARNING: keep this up-to-date! | ||
//'debug' => true, // enables debug mode | ||
//'authType' => 'MyOAuthPHPLib' // your own authentication type, see AuthTypes directory | ||
) | ||
); | ||
|
||
$client = new \Upwork\API\Client($config); | ||
//$client::setOrgUidHeader('1234567890'); // Organization UID (optional) | ||
|
||
// $accessTokenInfo has the following structure | ||
// array('access_token' => ..., 'refresh_token' => ..., 'expires_in' => ...); | ||
// keeps the access token in a secure place | ||
// gets info of authenticated user | ||
$accessTokenInfo = $client->auth(); | ||
|
||
dd($accessTokenInfo); | ||
} | ||
} |