'How can I display user data from the scopes created in useAuthRequest?

I want to display the users name and email after authenticating them through an Azure AD login.

I am passing the scopes 'openid, profile, email' but don't know how to call them in my code.

Here is an extraction from my code:

    const [request, response, promptAsync] = useAuthRequest(
      {
        clientId: `${config.CLIENT_ID}`,
        clientSecret: `${config.CLIENT_SECRET}`,
        scopes: [ 'openid', 'profile', 'email'],
        prompt: 'login',
        redirectUri: "msauth.com.mybundleID://auth",
        returnUrl: "msauth.com.mybundleID://auth",
      },
      discovery
    );

How can I display the profile and email scopes in my app?



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source