Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to modify successRedirect in local authentication? #60

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

Comments

Projects
None yet
2 participants
@wuyuanyi135
Copy link

wuyuanyi135 commented Feb 14, 2016

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

This comment has been minimized.

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

This comment has been minimized.

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

This comment has been minimized.

Copy link
Author

wuyuanyi135 commented Feb 14, 2016

@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 join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.