# Microsoft guest account

Check how your app handles an invited Microsoft guest. Sign in as `you+guest@example.com` to exercise this provider behavior.

Use your own Mockatoo address with guest and your usual password. Combine tags with a dot, for example `you+guest.unverified@example.com`; see [Email tags](../email-tags.md).

## What each provider returns

The account is a guest in the app tenant, with a separate home identity provider.

| Provider | What your app gets |
| --- | --- |
| [Microsoft](../providers/microsoft.md) | An invited guest when the app’s tenant is a specific tenant: tid and iss name that tenant, idp names the guest’s home tenant, and oid differs from the user’s own. Can be combined with personal. |

## Test it with Playwright

This test signs in with Microsoft as `you+guest@example.com` and checks that sign-in completes. It reads MOCKATOO_TEST_EMAIL and MOCKATOO_TEST_PASSWORD from the environment.

```ts
import { expect, test } from "@playwright/test";

const email = process.env.MOCKATOO_TEST_EMAIL ?? "";
const password = process.env.MOCKATOO_TEST_PASSWORD ?? "";

test("+guest: accepts a Microsoft guest", async ({ page }) => {
	const address = email.replace("@", `+e2e-${crypto.randomUUID()}.guest@`);
	// This app uses the common tenant. It accepts guests without requiring
	// membership in a particular organization's tenant.
	await page.goto("/");
	await page.getByRole("button", { name: "Sign in with Microsoft" }).click();
	await page.getByLabel("Email", { exact: true }).fill(address);
	await page.getByLabel("Password", { exact: true }).fill(password);
	await page.getByRole("button", { name: "Log in with password" }).click();
	await page.getByRole("button", { name: "Authorize" }).click();
	await expect(page.getByRole("heading", { name: "Your session" })).toBeVisible(
		{ timeout: 15_000 },
	);
	expect(
		JSON.parse((await page.locator("pre code").textContent()) ?? "").user.email,
	).toBe(address);
});
```

It runs in CI as [tests/tags/guest.spec.ts](https://github.com/mockatoo/examples/blob/main/better-auth-next/tests/tags/guest.spec.ts) in the Better Auth + Next.js example.
