Skip to main content
Glama

authenticate_account

Initiate device flow authentication for a Microsoft account, providing a URL and code for user verification to enable access to Microsoft Graph API services.

Instructions

Authenticate a new Microsoft account using device flow authentication

Returns authentication instructions and device code for the user to complete authentication. The user must visit the URL and enter the code to authenticate their Microsoft account.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • The handler function for the 'authenticate_account' tool. It initiates the MSAL device flow authentication, generates a device code and verification URL, and returns structured instructions for the user to complete the authentication process.
    @mcp.tool def authenticate_account() -> dict[str, str]: """Authenticate a new Microsoft account using device flow authentication Returns authentication instructions and device code for the user to complete authentication. The user must visit the URL and enter the code to authenticate their Microsoft account. """ app = auth.get_app() flow = app.initiate_device_flow(scopes=auth.SCOPES) if "user_code" not in flow: error_msg = flow.get("error_description", "Unknown error") raise Exception(f"Failed to get device code: {error_msg}") verification_url = flow.get( "verification_uri", flow.get("verification_url", "https://microsoft.com/devicelogin"), ) return { "status": "authentication_required", "instructions": "To authenticate a new Microsoft account:", "step1": f"Visit: {verification_url}", "step2": f"Enter code: {flow['user_code']}", "step3": "Sign in with the Microsoft account you want to add", "step4": "After authenticating, use the 'complete_authentication' tool to finish the process", "device_code": flow["user_code"], "verification_url": verification_url, "expires_in": flow.get("expires_in", 900), "_flow_cache": str(flow), }

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/elyxlz/microsoft-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server