How to get a user picture in the Laravel web application after Azure AD Login credential?

Md Jamil Uddin 41 Reputation points
2022-08-05T13:52:44.263+00:00

Hi,

I have a Laravel web app project with an Azure AD login credential (using Microsoft Graph) that works pretty well on localhost. How can I get the profile picture on the profile icon?

228556-image.png

Code:

@if(isset($userName))

          <li class="nav-item dropdown">  
            <a class="nav-link dropdown-toggle" data-toggle="dropdown" href="#" role="button"  
              aria-haspopup="true" aria-expanded="false">  
              ***@if(isset($user_avatar))  
                <img src="{{ $user_avatar }}" class="rounded-circle align-self-center mr-2" style="width: 32px;">  
              @else***  
                <i class="far fa-user-circle fa-lg rounded-circle align-self-center mr-2" style="width: 32px;"></i>  
              @endif  

</a>
<div class="dropdown-menu dropdown-menu-right">
<h5 class="dropdown-item-text mb-0">{{ $userName }}</h5>
<p class="dropdown-item-text text-muted mb-0">{{ $userEmail }}</p>
<div class="dropdown-divider"></div>
<a href="/signout" class="dropdown-item">Sign Out</a>
</div>
</li>
@Else
<li class="nav-item">
<a href="/signin" class="nav-link">Sign In</a>
</li>

@endif

Can somebody guide me in the correct code. please ?

Microsoft Security Microsoft Graph
{count} votes

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.