Skip to content

Username/Password (Resource Owner Password Credentials) flow using the built-in method.

Uses GraphClient.with_username_and_password for direct token acquisition.

Reference

View source

from office365.graph_client import GraphClient
from tests import test_client_id, test_password, test_tenant, test_username

client = GraphClient(tenant=test_tenant).with_username_and_password(test_client_id, test_username, test_password)
me = client.me.get().execute_query()
print(me)

← Back to Microsoft Graph Authentication