Skip to content

SharePoint on premise FBA authentication

Sergei Sergeev edited this page Aug 8, 2017 · 3 revisions

Form-based authentication for SharePoint on-premises.

Credentials options:

  • username - required string, fba username
  • password - required string, fba user password
  • fba - should be always equals to true for FBA authentication. Explicit indication, that FBA flow should be used

Example:

{
    username: 'fba_user',
    password: 'P@ssword',
    fba: true
}

Resolving object:

{
  headers: {
    'Cookie': 'FedAuth=77u/PD94bWwgdm....'
  }
}

Configuration required:

Configured FBA web application.

Sample using:

import * as spauth from 'node-sp-auth';
import * as request from 'request-promise';

spauth
  .getAuth('https://sp2013dev/sites/dev/', {
    username: 'fba_user',
    password: 'P@ssword',
    fba: true
  })
  .then(data => {
    let headers = data.headers;
    headers['Accept'] = 'application/json;odata=verbose';

    request.get({
      url: 'https://sp2013dev/sites/dev/_api/web',
      headers: headers,
      json: true,
      rejectUnauthorized: false
    }).then(response => {
      console.log(response.d.Title);
    });
  });