Title

Home

This library is part of the Malibu Framework.

This is a set of functions that is to be used to integrate bridgekeeper api's with the malibu framework.

If you are looking for a good place to start, take a look at the malibu tutorial.

Installing

@quintype/bridgekeeper-js is already installed into projects generated from malibu by default. However, if you wish to install it separately, or upgrade the version, then simply the following to get the latest version.

npm install @quintype/bridgekeeper-js --save

Configuration

Google

  • Configure google project for your application here and get the client-id and client-secret.
  • Add http://<your-domain>/api/auth/v1/google/callback to Authorized redirect URIs.
  • Bridgekeeper's realm table's oauth_credentials has to be updated with following details. Contact Quintype for this.
{
    "google": {
       "client-id": "CLIENT-ID",
       "callback-url": "http://<your-domain>/api/auth/v1/google/callback",
       "client-secret": "CLIENT-SECRET",
       "login-failure-redirect-url": "http://<your-domain>/<failure-redirect-path>"
       }
}
  • Url to hit from your app for google oauth: GET /api/auth/v1/login?auth-provider=google&redirect-url=<redirectURL>. This will open up the google account login page and on successful authentication by google will redirect to GET /api/auth/v1/google/callback
  • On successful authorization, bridgekeeper return 200 and set qt-auth cookie and redirect to the root url (/) of your domain
  • On failure redirects to the configured login-failure-redirect-url.

Facebook

  • Configure facebook project for your application here and get the client-id and client-secret.
  • Add http://<your-domain>/api/auth/v1/facebook/callback to Authorized redirect URIs.
  • Bridgekeeper's realm table's oauth_credentials has to be updated with following details. Contact Quintype for this.
{
    "facebook": {
       "client-id": "CLIENT-ID",
       "callback-url": "http://<your-domain>/api/auth/v1/facebook/callback",
       "client-secret": "CLIENT-SECRET",
       "login-failure-redirect-url": "http://<your-domain>/<failure-redirect-path>"
       }
}
  • Url to hit from your app for facebook oauth: GET /api/auth/v1/login?auth-provider=facebook. This will open up the facebook account login page and on successful authentication by facebook will redirect to GET /api/auth/v1/facebook/callback
  • On successful authorization, brigdekeeper return 200 and set qt-auth cookie and redirect to the root url (/) of your domain
  • On failure, redirects to the configured login-failure-redirect-url.

For OTP and Email verification template customization

  • Configure project(for eg: sendgrid/mandrill) for your application and get the api-key and template-id.
  • Bridgekeeper's realm table's oauth_credentials has to be updated with following details. Contact Quintype for this.

Apple

  • Configure Apple app id, service id and keys for your application here. You can refer this page for creating the same.
  • Add https:///api/auth/v1/apple/callback and as redirect URL and domain respectively to the service created in Apple developer account.
  • Bridgekeeper's realm table's oauth_credentials has to be updated with following details. Talk to platform devs for this.
{
	"apple": {
		"key-id": "APPLE-PRIVATE-KEY-ID",
		"team-id": "APPLE-TEAM-ID",
		"client-id": "APPLE-CLIENT-ID",
		"callback-url": "https://<your-domain>/api/auth/v1/apple/callback",
		"private-key-string": "-----BEGIN PRIVATE KEY-----\n<PRIVATE KEY>\n-----END PRIVATE KEY-----",
		"login-failure-redirect-url": "https://<your-domain>/<failure-redirect-path>"
	}
}
  • Url to hit from your app for apple oauth: GET /api/auth/v1/login?auth-provider=apple&redirect-url=. This will open up the apple signin page and on successful authentication by apple will redirect to POST /api/auth/v1/apple/callback
  • On successful authorization, brigdekeeper return 200 and set qt-auth cookie and redirect to the root url (/) of your domain
  • On failure redirects to the configured login-failure-redirect-url.

Implement login (Popup-flow) functionality in local machine

  • Facebook and Google login do not support localhost:3000 to be whitelisted. Create a domain mapping for example malibu.lvh.me: localhost:3000 (incase of malibu) in publisher.yml.

    Eg:

    asset_host: http://localhost:8080
    sketches_host: https://malibu-web.qtstage.io
    domain_mapping:
      subdomain.lvh.me: subdomain
      malibu.lvh.me: localhost:3000
    publisher:
    ...
    ...
    
  • Whitelist this domain URL, in this case malibu.lvh.me:3000 in facebook and google dashboard.

  • whitelisted_domains and domains column has to be updated with domain URL(eg: malibu.lvh.me:3000) in the bridgekeeper’s realm table. Contact Quintype for this.

  • Once these configurations are done, run the app on the domain URL(malibu.lvh.me:3000) instead of localhost:3000 and try to log in.