lauragift21
lauragift21

Reputation: 117

Unable to integrate sails-auth library in sails project

I'm trying to add the sails-auth library to my sails app. after installation and running sails lift i get this error returned

debug: hookPath: /home/egwuenu/Desktop/shopper/server/node_modules/sails-auth/dist/api/hooks/auth
debug: marlinspike (auth): loading config from /home/egwuenu/Desktop/shopper/server/node_modules/sails-auth/dist/configdebug: marlinspike (auth): loading Services from /home/egwuenu/Desktop/shopper/server/node_modules/sails-auth/dist/api/services...
debug: marlinspike (auth): loading Models...debug: marlinspike (auth): loading Controllers...
debug: marlinspike (auth): loading Policies...error:
error: TypeError: sails.getBaseurl is not a function

Upvotes: 1

Views: 302

Answers (1)

Rachael
Rachael

Reputation: 36

The sails-auth library is a 3rd-party module that hasn't been updated in a few years, so it's likely not compatible with newer versions of Sails (1.0 and later). In the spot where it's failing, it's trying to use sails.getBaseUrl, which is deprecated as of Sails 1.0. (And looks like the capitalization was off to begin with: it's using getBaseurl instead of getBaseUrl with a capital "U", so it may not have worked even with older versions of Sails.)

For built-in auth in Sails 1.0 and later, try generating a new app with: sails new foo --caviar. (You can reference an example app built with that template here.)

Upvotes: 2

Related Questions