# Example #1

## Setup

To use this example, set the following environment variables:

    SAMPLE_FACEBOOK_APP_ID
    SAMPLE_FACEBOOK_APP_SECRET

    SAMPLE_TWITTER_CONSUMER_KEY
    SAMPLE_TWITTER_CONSUMER_SECRET

    SAMPLE_LINKEDIN_API_KEY
    SAMPLE_LINKEDIN_API_SECRET

To build:

    npm install

To run:
    node app

## How it works

The index.html page provides links to `/auth/{providerId}` which redirect you to the authentication provider, such as Facebook.
The user logs in to Facebook and tells Facebook that the application is permitted to access the user profile.

Facebook then redirects the user back to the app at `/auth/{providerId}/callback`.

The `autoRegister` option is set to true which causes a Cloud CMS user to automatically be created for the Facebook user.

The browser is then redirected to `successRedirect` which is `index.html`.

The `passTicket` option is set to `true` so that the request parameter `ticket`.
The `passTokens` option is set to `true` so that the request parameter `accessToken` and `refreshToken` are set.

The browser JavaScript finds the `ticket` request parameter and authenticates using it, which sets the `GITANA_TICKET` cookie into the browser.
