Microsoft Graph API for Personal Accounts

lemur 21 Reputation points
2021-12-24T21:41:16.237+00:00

Hi,

for my registered app I have selected Personal Accounts as I only want to use /me subpaths.
When I'm using the InteractiveBrowserCredential from azure.identity Python package, to authenticate and try to log in with my account I get the error You can't sign in here with a personal account. Use your work or school account instead. Now, I'd like to use that app for my personal account, so this obviously won't work if I need to use work or school one.

I tried changing the accounts scope in the AppRegistrations but to no effect. What is a suggested way of configuring the app for such use cases?

Thank you

Microsoft Security | Microsoft Graph
{count} votes

3 answers

Sort by: Most helpful
  1. Zehui Yao_MSFT 5,876 Reputation points
    2021-12-28T01:53:55.08+00:00

    Hi, @lemur , you can change the /{tenant id} as /common, when you want to sign in your personal Account. You can refer to this document: https://learn.microsoft.com/en-us/azure/active-directory/develop/active-directory-v2-protocols#endpoints


    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.

    1 person found this answer helpful.

  2. lemur 21 Reputation points
    2022-01-26T20:41:21.897+00:00

    @Zehui Yao_MSFT
    When I changed my code to this:

    scopes = ['User.Read.All', 'Notes.Read.All']  
    credential = DeviceCodeCredential(client_id=CLIENT_ID,  tenant_id="common")  
    client = GraphClient(credential=credential, scopes=scopes)  
    result = client.get('/me/onenote/notebooks')  
    print(result.json())  
    

    It says I log in successfully (as before) and then when I try to access /me/onenote/notebooks I get the following error:
    {'error': {'code': '40001', 'message': 'The request does not contain a valid authentication token. Detailed error information: {0}', 'innerError': {'date': '2022-01-26T20:38:38', 'request-id': '89e111d3-6c57-449a-b6cd-51fec8cd3214', 'client-request-id': '400d9b85-4b24-48b4-adee-9e1ef669c3be'}}}


  3. Thiago Teberga 1 Reputation point
    2022-11-01T03:12:03.537+00:00

    @lemur i'm having the same problem, i'm using a personal account, and i'm trying to use the "me/messages" route, but locally i receive the error "ErrorAccessDenied - Access is denied. Check credentials and try again."
    I checked the authorization roles, and i'm using "common" instead "TenantID", but nothing solved the problem...
    I did what you said, about copy the token created by Graph Explorer and use this on my application, and it works fine, but not solves the real problem.
    Did you find a way to solve this?

    0 comments No comments

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.