How to get access package information using graph azure api

GKaur 0 Reputation points
2023-09-05T00:31:07.11+00:00

I am bringing user in AD as guest using B2B .I want to read access package request information of signed user . Ho can I read information using azue graph api in my app ? how can I authenticate guest user using azure authentication to access my app ?

Microsoft Graph
Microsoft Graph
A Microsoft programmability model that exposes REST APIs and client libraries to access data on Microsoft 365 services.
2,106 questions
Microsoft Graph Users API
Microsoft Graph Users API
A Microsoft API that allows you to build compelling app experiences based on users, their relationships with other users and groups, and the resources they access for example their mails, calendars, files, administrative roles, group memberships.
877 questions
Microsoft Graph Identity API
Microsoft Graph Identity API
A Microsoft API to access Azure Active Directory (Azure AD) resources to enable scenarios like managing administrator (directory) roles, inviting external users to an organization, and, if you are a Cloud Solution Provider (CSP), managing your customer's data.
308 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. CarlZhao-MSFT 28,531 Reputation points
    2023-09-05T08:08:31.61+00:00

    Hi @GKaur

    Of course, if the target user has joined your tenant as a guest, its authentication method is no different from that of a member user.

    Since this involves user login, you need to use a delegated authentication flow to obtain an access token, such as the auth code flow.

    First run the authorization URL in the browser and log in to the app using the guest user to get the authorization code.

    https://login.microsoftonline.com/{tenant id}/oauth2/v2.0/authorize?
    client_id={client id}
    &response_type=code
    &redirect_uri={redirect url}
    &response_mode=query
    &scope={scope}
    &state=12345
    

    Then use the authorization code to redeem the access token.

    POST /{tenant}/oauth2/v2.0/token HTTP/1.1
    Host: https://login.microsoftonline.com
    Content-Type: application/x-www-form-urlencoded
    
    client_id={client id}
    &scope={scope}
    &code=OAAABAAAAiL9Kn2Z27UubvWFPbm0gLWQJVzCTE9UkP3pSx1aXxUjq3n8b2JRLk4OxVXr...
    &redirect_uri={redirect url}
    &grant_type=authorization_code
    &client_secret={client secret} 
    

    Hope this helps.

    If the reply is helpful, please click Accept Answer and kindly upvote it. If you have additional questions about this answer, please click Comment.