sagarrabadiya / outlook-php Goto Github PK
View Code? Open in Web Editor NEWA handy tool to work with outlook rest api
License: MIT License
A handy tool to work with outlook rest api
License: MIT License
i receive $_GET['code'] variable value form my Redirect URL
but after not execute try block it is direct it's catch block execute, so why am i not able to get proper success response.
here is issue file located: src/Outlook/Authorizer/Authenticator.php
try {
$response = $httpClient->post($this->authority.$this->tokenUrl, [
'form_params' => $params
]);
// we got token successfully save it to session
$tokenResponse = $this->deserialize($response->getBody()->getContents());
$token = $this->buildTokenInstance($tokenResponse);
$this->sessionManager->set($token);
return $token;
} catch (\Exception $e) {
throw new TokenException($e->getMessage(), $e->getCode(), $e);
}
It works fine for the authenticated user. Is the authenticated user can create events on others outlook account?
I have written a PHP api that connects to a Microsoft account to add appointments to a calendar, and this works fine. For first time use, the user is required to authenticate with username and password before a token is issued. Is there a way to bypass internally with PHP (passing a username password) without prompting the user to do so?
The authentication instructions in the README seem to be the ones corresponding to the login as a user, is that correct? Could you please give me a hint if any of your code can be extended/reused for the login as a service? I will implement it and open a PR if you want (and if I am not misunderstanding something).
Trying to log in to my organisation account, using an app ID registered using the same account, I'll get this error:
AADSTS50194: Application 'xxxxxxxxxx' is not configured as a multi-tenant application. Usage of the /common endpoint is not supported for such applications created after '10/15/2018'. Use a tenant-specific endpoint or configure the application to be multi-tenant.
Microsoft site states the following:
By default, web app/API registrations in Azure AD are single tenant. You can make your registration multi-tenant by finding the Multi-Tenanted switch on the Properties pane of your application registration in the Azure portal and setting it to Yes.
There is an Tenant restrictions
page in Azure, but You don’t have access to this data. Please contact your global administrator to get access.
I also have an Directory (tenant) ID
as well as an list of different endpoints available, witch all include the tenant in the URL, so where do I specify the tenant in this library?
I just want API access to access my own calendar, that's it...
use GuzzleHttp\Client;
private function getToken($grantType,$code){
try{
$parameterName = $grantType;
if (strcmp($parameterName, 'authorization_code') == 0) {
$parameterName = 'code';
}
$httpClient = new \GuzzleHttp\Client();
$params = [
"grant_type" => $grantType,
$parameterName => $code,
"redirect_uri" => REDIRECT_URI_OUTLOOK,
"scope" => implode(" ", ['openid', 'offline_access']),
"client_id" => APP_ID_OUTLOOK,
"client_secret" => APP_PASSWORD_OUTLOOK
];
$response = $httpClient->post("https://login.microsoftonline.com/common/oauth2/v2.0/token",
['form_params' => $params]);
$token = $response->getBody()->getContents();
return $token;
} catch (Exception $e) {
}
}
getToken('refresh_token',$refreshToken);
My access token expired.
How can I get the new access token using refresh token ?
Please help
How to get the edit permissible calendars separately?
Also,the Outlook username and email of the authorised account?
I don't want to use Session for storing tokens and also don't want to use it for eventAuthorizer.
Also,I want to use a function to get tokens by passing in the code parameter (which too don't want to obtain from $_GET method).
When tried to add an event to Outlook Calendar,the above mentioned exception is thrown.Please help!!
Could you please add this feature too?
Tried the example in the readme, but got this error...
Seems like some (unknown) class isn't constructed at time of a member function call.
Version 0.1.5
PHP 7.2.14
Fatal error: Uncaught Error: Call to a member function set() on null in /vendor/sagar/outlook-php/src/Outlook/Authorizer/Authenticator.php:111
Stack trace:
#0 Outlook\Authorizer\Authenticator->getToken()
#1 {main}
thrown in /vendor/sagar/outlook-php/src/Outlook/Authorizer/Authenticator.php on line 111
Following the events example I get the following error:
Fatal error:
Uncaught Outlook\Exceptions\Events\RestApiException: The audience claim value is invalid 'aud'. in (...)/vendor/sagar/outlook-php/src/Outlook/Events/EventManager.php:52
Stack trace:
#0 (...)/ocal.php(36): Outlook\Events\EventManager->all()
#1 {main}
thrown in (...)/vendor/sagar/outlook-php/src/Outlook/Events/EventManager.php on line 52
No idea why, can't find the value aud
anywhere either...
Any suggestions?
{
"error": "invalid_grant",
"error_description": "AADSTS70000: The user could not be authenticated as the grant is expired. The user must sign in again.\r\nTrace ID: 57a50e0a-2446-4543-8760-aff1583b2b00\r\nCorrelation ID: 80554d13-fead-4e28-a311-cf106e42dd92\r\nTimestamp: 2019-05-24 10:32:25Z",
"error_codes": [
70000
],
"timestamp": "2019-05-24 10:32:25Z",
"trace_id": "57a50e0a-2446-4543-8760-aff1583b2b00",
"correlation_id": "80554d13-fead-4e28-a311-cf106e42dd92"
}
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.