Skip to content
This repository has been archived by the owner on Mar 22, 2022. It is now read-only.

How to modify successRedirect in local authentication? #60

Closed
wuyuanyi135 opened this issue Feb 14, 2016 · 3 comments
Closed

How to modify successRedirect in local authentication? #60

wuyuanyi135 opened this issue Feb 14, 2016 · 3 comments

Comments

@wuyuanyi135
Copy link

I just tested to modify this option in the authentication argument list

    .configure(authentication({
        token:{
            secret: 'InYATTDuYA'
        },
        local: {
            usernameField:"username",
            userEndpoint: userMountPoint
        },
        successRedirect: 'auth/changed'

but I got exception

You need to provide your 'clientID' and 'clientSecret' if using an OAuth2 provider or your 'consumerKey' and 'consumerSecret' if using an OAuth1 provider.
    at /home/wuyuanyi/riddle-web/node_modules/feathers-authentication/lib/index.js:81:19

Is this desired behavior? maybe successRedirect is a private option?

@ekryski
Copy link
Member

ekryski commented Feb 14, 2016

@wuyuanyi135 it's your successRedirect value. That's an invalid key at that level. It's only valid inside an OAuth provider or the local provider. So it needs to look like this:

.configure(authentication({
  token: {
    secret: 'shhh secrets'
  },
  local: {
    usernameField: 'username',
    userEndpoint: userMountPoint,
    successRedirect: 'auth/changed'
  }

We're trying to be smart and infer that if it's not a token or a local config option then it must be an OAuth provider. I might change up the error message to be a bit more clear.

@ekryski
Copy link
Member

ekryski commented Feb 14, 2016

Currently this redirect is only called if you are using a browser and the request didn't happen over ajax or sockets.

I realized that another issue you'll run into is we need to disable our custom route handler if you pass in a successRedirect (#61)

Apologies for any confusion or frustration! I honestly wasn't expecting anyone to use this just yet so you're being an awesome beta tester 😉!

@wuyuanyi135
Copy link
Author

@ekryski Thanks :) That's all fine.
I was reading the source to determine how to place the options. Probably after API reference or docs is updated to 0.2.x compatible then everything will be fine.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants