authenticationsails.jswaterlock

Sailsjs Waterlock - Set up multiple auth methods


I have been learning how to use SailsJS most effectively, which includes using authentication. After the nightmare that sails-auth gave me, I decided to use Waterlock.

I have a default setup with Waterlock. I am trying to use multiple auth strategies (waterlock-local-auth + waterlock-google-auth).

Whenever I POST credentials to the register page, I am presented with

HTTP 400: you must specify a type parameter.

After reading the code, I notice I must submit an authentication type string with my form submit. So I add <input type="hidden" name="type" value="waterlock-local-auth"/> to the form. However, now I am presented with this:

HTTP 400: unknown/invalid authentication type

Why?


Solution

  • The proper way to encode the type string in the form data this way:

    The input tag (if using local, for example) would look like this:

    <input type="hidden" name="type" value="local"/>