CrushMFT Documentation

SharePoint: signing in as a user#

With Delegated Permission, a SharePoint item acts as a person: somebody signs in to Microsoft once, and from then on the server reaches SharePoint with that person's rights. It can do what that person can do, and nothing more.

Use it when the server should see exactly one person's or one service account's share of SharePoint, or when nobody will grant an app rights of its own.

At Microsoft#

  1. Register an app, with the redirect URI: see The app registration. The redirect URI is needed for this way:

    https://files.example.com/register_microsoft_graph_api/
    
  2. Under API permissions, Add a permission, Microsoft Graph, Delegated permissions. Find Files and tick Files.ReadWrite.All.

  3. Press Grant admin consent. Without it, every person is asked for consent at sign-in, which many organizations do not allow.

  4. Under Certificates & secrets, make a New client secret and copy its value.

Files.ReadWrite.All as a delegated permission does not mean "all files of the organization". It means: all files the signed-in person can reach.

In the item#

  1. Choose the item type SharePoint and the choice Delegated Permission.
  2. Press Get Refresh Token. Enter the Client ID, the Client Secret and the Tenant. If the server is published under a path of a reverse proxy, enter the Reverse Proxy Path.
  3. A Microsoft window opens. Sign in as the account the server shall act as, and accept.
  4. The window closes; User name and Password of the item are filled in with the client and the token.
  5. Say where: paste a Shared Link, or fill in the site and library. See Where in SharePoint.
  6. Press Test.

The sign-in must be made in a browser that reaches the server by the very address of the redirect URI.

Which account to sign in with#

Not your own. Make an account for this purpose, a service account, and give it rights on just the sites the server needs. Then:

  • the server does not lose its access when a colleague leaves;
  • what the server does in SharePoint is shown under a name that says so;
  • nobody's personal files are within the server's reach.

An account with a second factor can sign in here: the factor is asked for once, in the Microsoft window.

Keeping it alive#

The token renews itself as long as it is used. It stops working when

  • the account's password is changed or reset;
  • an administrator revokes the account's sessions;
  • the client secret of the app expires;
  • a conditional access rule starts to refuse the server's address;
  • it was not used for 90 days.

Then open the item and press Get Refresh Token again. An alert can tell you: see When a storage login stops working.

To spare yourself the dates, use an app that acts for itself: An app with a certificate.