-
Notifications
You must be signed in to change notification settings - Fork 6
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
1 parent
c7c7fb1
commit 4a5b5b3
Showing
8 changed files
with
172 additions
and
89 deletions.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,2 @@ | ||
/vendor/ | ||
/vendor/ | ||
/examples/vendor/ |
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 |
---|---|---|
@@ -1,41 +1,43 @@ | ||
{ | ||
"name": "adnanhussainturki/microsoft-api-php", | ||
"description": "PHP Wrapper the OneDrive API", | ||
"keywords": [ | ||
"onedrive", | ||
"api" | ||
], | ||
"homepage": "https://github.com/AdnanHussainTurki/microsoft-api-php", | ||
"license": "MIT", | ||
"authors": [ | ||
{ | ||
"name": "Adnan Hussain Turki", | ||
"email": "[email protected]", | ||
"homepage": "https://www.myphpnotes.com", | ||
"role": "Developer" | ||
} | ||
], | ||
"require": { | ||
"php": ">=5.6", | ||
"microsoft/microsoft-graph": "^1.0" | ||
}, | ||
"require-dev": { | ||
"phpunit/phpunit": "^6.0" | ||
}, | ||
"autoload": { | ||
"psr-4": { | ||
"myPHPnotes\\Microsoft\\": "src" | ||
} | ||
}, | ||
"autoload-dev": { | ||
"psr-4": { | ||
"myPHPnotes\\Microsoft\\Test\\": "tests" | ||
} | ||
}, | ||
"scripts": { | ||
"test": "vendor/bin/phpunit" | ||
}, | ||
"config": { | ||
"sort-packages": true | ||
"name": "adnanhussainturki/microsoft-api-php", | ||
"description": "PHP Wrapper the Microsoft Graph API", | ||
"keywords": [ | ||
"sign with microsoft", | ||
"onedrive", | ||
"api" | ||
], | ||
"homepage": "https://github.com/AdnanHussainTurki/microsoft-api-php", | ||
"license": "MIT", | ||
"authors": [ | ||
{ | ||
"name": "Adnan Hussain Turki", | ||
"email": "[email protected]", | ||
"homepage": "https://www.myphpnotes.com", | ||
"role": "Developer" | ||
} | ||
], | ||
"require": { | ||
"php": ">=5.6", | ||
"microsoft/microsoft-graph": "^1.0", | ||
"league/flysystem": "^1.0" | ||
}, | ||
"require-dev": { | ||
"phpunit/phpunit": "^6.0" | ||
}, | ||
"autoload": { | ||
"psr-4": { | ||
"myPHPnotes\\Microsoft\\": "src" | ||
} | ||
}, | ||
"autoload-dev": { | ||
"psr-4": { | ||
"myPHPnotes\\Microsoft\\Test\\": "tests" | ||
} | ||
}, | ||
"scripts": { | ||
"test": "vendor/bin/phpunit" | ||
}, | ||
"config": { | ||
"sort-packages": true | ||
} | ||
} |
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,26 @@ | ||
<?php | ||
|
||
use myPHPnotes\Microsoft\Auth; | ||
use myPHPnotes\Microsoft\Handlers\Session; | ||
use myPHPnotes\Microsoft\Models\User; | ||
|
||
session_start(); | ||
|
||
require 'vendor/autoload.php'; | ||
|
||
$auth = new Auth( | ||
Session::get('tenant_id'), | ||
Session::get('client_id'), | ||
Session::get('client_secret'), | ||
Session::get('redirect_uri'), | ||
Session::get('scopes') | ||
); | ||
$tokens = $auth->getToken($_REQUEST['code'], $_REQUEST['state']); | ||
|
||
$accessToken = $tokens->access_token; | ||
|
||
$auth->setAccessToken($accessToken); | ||
|
||
$user = new User(); | ||
echo 'Name: ' . $user->data->getDisplayName() . '<br>'; | ||
echo 'Email: ' . $user->data->getUserPrincipalName() . '<br>'; |
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,6 @@ | ||
{ | ||
"require": { | ||
"adnanhussainturki/microsoft-api-php": "^0.03.0", | ||
"league/flysystem": "^2.0" | ||
} | ||
} |
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,11 @@ | ||
<!DOCTYPE html> | ||
<html lang="en"> | ||
<head> | ||
<meta charset="UTF-8"> | ||
<meta name="viewport" content="width=device-width, initial-scale=1.0"> | ||
<title>Sign in with Microsoft</title> | ||
</head> | ||
<body> | ||
<a href="/signin.php">Sign in with Microsoft</a> | ||
</body> | ||
</html> |
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,17 @@ | ||
<?php | ||
|
||
session_start(); | ||
|
||
require 'vendor/autoload.php'; | ||
|
||
use myPHPnotes\Microsoft\Auth; | ||
|
||
$tenant = 'common'; | ||
$client_id = 'YOUR_CLIENT_ID_HERE'; | ||
$client_secret = 'YOUR_CLIENT_SECRET_HERE'; | ||
$callback = 'http://localhost:8080/callback.php'; // Your callback URL | ||
$scopes = ['User.Read', 'Files.ReadWrite.All', 'offline_access']; | ||
|
||
$microsoft = new Auth($tenant, $client_id, $client_secret, $callback, $scopes); | ||
|
||
header('location: ' . $microsoft->getAuthUrl()); |
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