Office 365 smart link generator for a SAML IdP

Linking to an Office 365 resource (e.g. SharePoint site) won't initiate single sign-on automatically. That's where smart links come in. A smart link is your realm and your resource address encoded in a login URL.

This generator is useful for Office 365 instances that are configured for SAMLP authentication. For ADFS WS-federation, see Scott Brickey's blog, Microsoft's wiki and Travis Spencer's generator.

The generator includes optional handling for session collisions, where existing O365 sessions in other realms may exist and you want to initiate a new session with your realm. Without the login_hint parameter, O365 appears to use an existing session which usually means you'll run into a "User not in directory" issue (currently a "That didn't work" page). With the login_hint parameter, you should at least get presented with a choice between the existing sessions and the new one.

Format: https://login.microsoftonline.com/login.srf?wa=wsignin1.0&whr=[1]&wreply=[2]&login_hint=[3]

  1. [1] whr: Home Realm, aka domain
  2. [2] wreply: URL we want to redirect to
  3. [3] login_hint: Hint the Home Realm domain (from [1]) if we are expecting collisions with other O365 sessions