Authentication

Picket Web Service uses a standard based OAuth 2.0 Client Credentials grant authentication method. You can use any library that provides support for this flow.

In this flow client service exchanges Client ID and Client Secret (API keys management) for an access token using the authentication token endpoint. This endpoint allows to obtain access token as well as the refresh token.

Example code

In this example code we are using simple-oauth2 library to get the access token.

import { ClientCredentials } from 'simple-oauth2';

  const oauthConfig = {
    client: {
        id: 'insert your Client ID',
        secret: 'insert your Client Secret',
      },
    auth: {
      tokenHost: 'https://api.pickethomes.com/',
      tokenPath: '/v1/auth/token',
      refreshPath: '/v1/auth/token'
    },
    http: {
      json: true,
    },
    options: {
      bodyFormat: 'json',
      authorizationMethod: 'body'
    }
  }
  const clientCredentials = new ClientCredentials(oauthConfig);
  try {
    let accessToken = await clientCredentials.getToken({});
    console.log(accessToken); // client_credentials flow
    // one can refresh the token with call
    // accessToken = await accessToken.refresh({});
    // console.log(accessToken); // refresh_token flow
  } catch (error) {
    console.log('Access Token Error', error.message);
  }

© 2024 Picket Homes.

All Rights Reserved.

Following Editorial Standards.

We are committed to providing digital accessibility for individuals with disabilities. If you would like to report an issue or request an accommodation, please let us know.

Picket Realty Services, LLC, holds brokerage licenses in multiple states.

NY Fair Housing Notice 442H Disclosure TREC: Information about brokerage services TREC: Consumer protection notice
About us Careers Terms & conditions Privacy policy
equal-housing-opportunity-logo