Comments (7)
thanks for reporting this, looks to be a problem with the API structure, not sure if there's been changes from Microsoft.
It seems that it no longer accepts a resource type when authenticating as a tenant, I've replicated this locally and working on testing it deeper before issuing a release.
Thank you for your time and for maintaining this repository. I am a big fan of your work and I appreciate all the effort you have put into it.
thank you, its great to hear its been useful to you.
from laravel-microsoft-graph.
thanks for reporting this, looks to be a problem with the API structure, not sure if there's been changes from Microsoft.
It seems that it no longer accepts a resource type when authenticating as a tenant, I've replicated this locally and working on testing it deeper before issuing a release.
Thank you for your time and for maintaining this repository. I am a big fan of your work and I appreciate all the effort you have put into it.
thank you, its great to hear its been useful to you.
I truly hope that you can find a solution to fix this issue soon. As I mentioned, I need this package for a project and it would be a huge setback for me if I can't use it. I will definitely keep an eye out for updates and hope that you can resolve this as soon as possible. Thank you again for all your hard work and for providing such a valuable resource.
from laravel-microsoft-graph.
I've just pushed up a new release now.
from laravel-microsoft-graph.
I've updated the repository in my project, and now when this function is executed:
public function connect()
{
return MsGraphAdmin::connect();
}
The website just returns json data!? Though I've set up routes for when user is authenticated via Microsoft, to return to a blade view which fetches some user data.
Is the issue on my project side or If I could get some help...?
from laravel-microsoft-graph.
with the new change added, connect doesn't need to be loaded directly after you've initially connected. Once you have a token a token would be requested when needed.
take this example:
Route::group(['middleware' => ['web', 'MsGraphAdminAuthenticated']], function(){
Route::get('/', function(){
//fetch all users
return MsGraphAdmin::get('users');
});
});
Route::get('connect', function(){
return MsGraphAdmin::connect();
});
I'm loading users on a /
route internally called connect
when needed. If I manually go to the route then I see the same output as you see above.
from laravel-microsoft-graph.
When the user clicks on the "Login" button, it redirects him to the route "connect", which before authenticated the user,
and then the view blade was returned, now It just shows json data in the web. So how do I authenticate the user first, then redirect him to my view?
When I use MsGraph, instead of Admin, then when MsGraph::connect is returned, it sends the me to the Microsoft Login Form, and select an account then it authenticates me and redirects me to my view blade with the user data. But with MsGraphAdmin, instead of sending to Microsoft Login Form, it just prints the json data, the image that I uploaded above shows it.
Web routes:
Route::get('/', function () {
return view('auth.login');
})->name('login');
Route::group(['middleware' => ['web', 'auth']], function(){
Route::post('meeting', [AuthController::class, 'storeMeeting'])->name('meeting.store');
});
Route::group(['middleware' => ['web', 'guest'], 'namespace' => 'App\Http\Controllers'], function(){
Route::get('msgraph', 'AuthController@index')->name('index');
Route::get('msgraph/oauth', 'AuthController@connect')->name('connect');
});
AuthController:
<?php
namespace App\Http\Controllers;
use Dcblogdev\MsGraph\Facades\MsGraphAdmin;
use Illuminate\Http\Request;
class AuthController extends Controller
{
public function index()
{
if (! is_string(MsGraphAdmin::getAccessToken())) {
return redirect(env('MSGRAPH_OAUTH_URL'));
} else {
// Display Details
$user = MsGraphAdmin::get('me');
$contacts = MsGraphAdmin::get('me/contacts');
$events = MsGraphAdmin::get('me/events');
$teams = MsGraphAdmin::get('me/joinedTeams');
$meetings = [];
foreach ($teams['value'] as $team) {
$teamMeetings = MsGraphAdmin::get("teams/{$team['id']}/events");
$meetings = array_merge($meetings, $teamMeetings['value']);
}
return view('welcome', compact('user', 'contacts', 'events', 'meetings'));
}
}
public function connect()
{
return MsGraphAdmin::connect();
}
public function logout()
{
return MsGraphAdmin::disconnect('/');
}
public function storeMeeting(Request $request)
{
if (! MsGraphAdmin::isConnected()) {
return redirect('msgraph/oauth');
}
$subject = $request->input('subject');
$start_time = $request->input('start_time');
$end_time = $request->input('end_time');
$data = [
'subject' => $subject,
'start' => [
'dateTime' => $start_time,
'timeZone' => 'UTC',
],
'end' => [
'dateTime' => $end_time,
'timeZone' => 'UTC',
],
];
$response = MsGraphAdmin::post('/me/onlineMeetings', $data);
return redirect()->back();
}
}
from laravel-microsoft-graph.
I understand, I'm working on a way this can be used as both in the background and via user interaction.
stretch that I've pushed a new release where connect will redirect by default. To stop this pass false as a param and only the token would be returned.
I do want to clean up the internal code its getting pretty messy.
from laravel-microsoft-graph.
Related Issues (20)
- Issues with Laravel 9 HOT 3
- Token retrieved from DB is not the good one in NewMicrosoft365SignInListener.php HOT 2
- Token information gets replaced HOT 2
- SharedMailbox HOT 2
- Moving emails in a sharedmailbox HOT 1
- Duplicate user after logout HOT 2
- Identity provider exception HOT 2
- Request for Calendar API Integration HOT 3
- Refreshing the token trough artisan command HOT 1
- Email not found | Ubuntu 22.04 server. HOT 1
- Mime type on attachments HOT 1
- Problem officeLocation only HOT 1
- urlResourceOwnerDetails is not visible in config file HOT 2
- Cannot use object of type stdClass as array HOT 1
- Invalid grant type HOT 2
- $userModel with type problems HOT 1
- Posting to /users/XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX/onlineMeetings returns string HOT 3
- 'Illuminate\Support\Facades\Http' not found HOT 1
- Versions higher than 3.2.4 seems to break getting emails
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from laravel-microsoft-graph.