Skip to main content

Azure AD (Microsoft Entra ID)

OIDC provider for work/school accounts.

import "github.com/izetmolla/goauth/providers/azuread"

azuread.New(azuread.Options{
ClientID: os.Getenv("AZURE_CLIENT_ID"),
ClientSecret: os.Getenv("AZURE_CLIENT_SECRET"),
TenantID: "common", // or your tenant GUID
Scopes: []string{"openid", "profile", "email", "User.Read"},
})

Scopes and ResolveUser

Extra Microsoft Graph scopes return tokens in ResolveUserParams.ProviderTokens — use ResolveUser to persist refresh tokens or call Graph on behalf of the user.

Callback URL: https://your-host/auth/callback/azuread (or custom ID).

See providers/azuread/README.md in the repository for tenant and scope details.