Don't try to use user flows/custom policies to get tokens for the graph API, user flows/custom policies can only be used to get tokens for your custom web APIs, not the graph APIs. You should use Azure AD-specific authentication flow(auth code flow or ROPC flow) to obtain graph API tokens for your Azure AD B2C tenant.
POST https://login.microsoftonline.com/{b2c tenant id}/oauth2/v2.0/token
Content-Type: application/x-www-form-urlencoded
client_id={the client ID of the B2C application}
&client_secret={client secret}
&scope=Directory.AccessAsUser.All
&username={b2c user name}
&password={user password}
&grant_type=password
If the answer is helpful, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.