Users

Overview

We are going to support registering users by traditional email / password and external login providers (i.e. facebook, google, twitter, github, etc..)

Purpose

Users can be useful for making reviews, comments, adding or editing items, voting, accessing premium features, etc.

Configuration

All authentication configuration is stored in ./config/root.json. You can override it in ./config/local.json.

In-memory

memory configuration is responsible for access administration panel (/admin) with in-memory credentials. This is the simpliest method and is used mostly to access administration panel.

{
  "auth": {
    "memory": {
      "username": "admin",
      "password": "itemsapi",
      "enabled": true
    }
  }
}

Facebook

In this case facebook for register / login. Use http://localhost:4000/auth/facebook/ to start login with facebook. You can create your app here - https://developers.facebook.com/apps/ to get all settings (clientID, clientSecret)

{
  "auth": {
    "facebook" : {
      "clientID" : "",
      "clientSecret": "",
      "callbackURL": "http://localhost:4000/auth/facebook/callback",
      "scope": ["public_profile", "email"],
      "profileFields": [
        "id", 
        "displayName", 
        "email", 
        "birthday", 
        "first_name", 
        "last_name", 
        "middle_name", 
        "gender", 
        "link", 
        "picture.type(large)"
      ]
    }
  }
}

Github

Github has very simple configuration process. Go to https://github.com/settings/applications/new. Create your app. You will get clientID and clientSecret and when you put it in below configuration then github authentication is working. Once you make it working then open http://localhost:4000/auth/github/ for testing.

{
  "auth": {
    "github" : {
      "clientID" : "",
      "clientSecret": "",
      "callbackURL": "http://localhost:4000/auth/github/callback",
      "scope": ["email:user"]
    }
  }
}

Linkedin

{
  "auth": {
    "linkedin" : {
      "clientID" : "",
      "clientSecret": "",
      "scope": ["r_basicprofile", "r_emailaddress"],
      "profileFields": ["id", "first-name", "last-name", "email-address", "headline", "picture-url"],
      "callbackURL": "http://localhost:4000/auth/linkedin/callback"
    }
  }
}

Go there https://developer.linkedin.com/docs/oauth2 to create application.

Was this page helpful ?