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

login redirect object url exploding the uri #35

Closed
nshCore opened this issue Oct 12, 2016 · 15 comments
Closed

login redirect object url exploding the uri #35

nshCore opened this issue Oct 12, 2016 · 15 comments

Comments

@nshCore
Copy link

nshCore commented Oct 12, 2016

After logging in im trying to redirect the app to a page called "/find"

but i keep getting redirected to the 404 page.

In the fetchPerform function if i console.log(data.redirect)

the object.redirect should contain the url "/find"

but the logged data is redirect
:
Object
0
:
"/"
1
:
"f"
2
:
"i"
3
:
"n"
4
:
"d"
name
:
"/account"

the loginData object in auth.js is set like

    loginData:          {url: 'auth/login',        method: 'POST', redirect: '/find'},

can you explain why this is doing this?

@websanova
Copy link
Owner

Hmm, what version are you using?

I just tested it and it seems to work. Also as a fix for now you can try setting redirect to {path: '/find'}.

@nshCore
Copy link
Author

nshCore commented Oct 12, 2016

im using the 1.0.0beta with a fresh install, im redirected to the account page but never the actual page set as a redirect in the auth.js

console logging the data object in the success callback of fetchperform shows this

{"url":"auth/login","method":"POST","redirect":{"0":"/","1":"f","2":"i","3":"n","4":"d","name":"account"},"body":{"email":"admin@admin.com","password":"admin"},"rememberMe":false,"query":{},"root":"http://api.dev"}

it looks like its redirecting to the name not the value of [0], if i change the component vue file name in app.js for account to find i see the expected page, but regardless it doesn't explain why its exploding the value of the redirect to a single letter in an array

@websanova
Copy link
Owner

There is no 1.0.0-beta, do you mean 1.1.0-beta?

@websanova
Copy link
Owner

Also can you give me version of vue and vue-modules you are using.

@nshCore
Copy link
Author

nshCore commented Oct 13, 2016

Sorry 1.0.0 version of vue 1.1.0-beta of your auth code,

heres my package.json on gist
https://gist.github.com/jkirkby91-2/b5ee7f385972e61032b686caeb4e6196

@websanova
Copy link
Owner

Can I see some of your code.

How you are initializing it.

On Oct 13, 2016 20:43, "jkirkby91-2" notifications@github.com wrote:

Sorry 1.0.0 version of vue 1.1.0-beta of your auth code,

heres my package.json on gist
https://gist.github.com/jkirkby91-2/b5ee7f385972e61032b686caeb4e6196


You are receiving this because you commented.
Reply to this email directly, view it on GitHub
#35 (comment),
or mute the thread
https://github.com/notifications/unsubscribe-auth/ABkcy6xWBd8mc0kBL8eE2fLd15YV6AOeks5qzjOmgaJpZM4KUVR5
.

@nshCore
Copy link
Author

nshCore commented Oct 13, 2016

literally standard app all ive added is two vue pages find and link list nothing elese modified, here is the app.js

https://gist.github.com/jkirkby91-2/7307347e407975a602c9d6d78db2662a

from auth.js just changed the logindata object from / to /find

    authRedirect:       {path: '/login'},
    forbiddenRedirect:  {path: '/403'},
    notFoundRedirect:   {path: '/404'},

    registerData:       {url: 'auth/register',     method: 'POST', redirect: '/login'},
    loginData:          {url: 'auth/login',        method: 'POST', redirect: '/find'},
    logoutData:         {url: 'auth/logout',       method: 'POST', redirect: '/', makeRequest: false},
    oauth1Data:         {url: 'auth/login',        method: 'POST'},
    fetchData:          {url: 'auth/user',         method: 'GET'},
    refreshData:        {url: 'auth/refresh',      method: 'GET'},
    loginOtherData:     {url: 'auth/login-other',  method: 'POST', redirect: '/'},
    logoutOtherData:    {url: 'auth/logout-other', method: 'POST', redirect: '/admin', makeRequest: false},

    facebookData:       {url: 'auth/facebook',     method: 'POST', redirect: '/'},
    googleData:         {url: 'auth/google',       method: 'POST', redirect: '/'},

@websanova
Copy link
Owner

So where are you setting that loginData?

On Oct 13, 2016 22:15, "jkirkby91-2" notifications@github.com wrote:

literally standard app all ive added is two vue pages find and link list
nothing elese modified, here is the app.js

https://gist.github.com/jkirkby91-2/7307347e407975a602c9d6d78db2662a


You are receiving this because you commented.
Reply to this email directly, view it on GitHub
#35 (comment),
or mute the thread
https://github.com/notifications/unsubscribe-auth/ABkcy1HW4WAJyhNQ8HQL4Sqmun1pMzsJks5qzkrogaJpZM4KUVR5
.

@nshCore
Copy link
Author

nshCore commented Oct 13, 2016

in login.vue nothing changed apart from username to email

export default {
data() {
return {
context: 'login context',

            data: {
                body: {
                    email: '',
                    password: ''
                },
                rememberMe: false
            },

            error: null
        };
    },

    methods: {
        login() {
            this.$auth.login({
                body: this.data.body,
                rememberMe: this.data.rememberMe,
                redirect: {name: 'account'},
                success() {
                    console.log('success ' + this.context);
                },
                error(res) {
                    console.log('error ' + this.context);

                    this.error = res.data;
                }
            });
        }
    }
}

@websanova
Copy link
Owner

Ok, so I see you are hacking the plugin directly? Can you make sure it's the latest version. Or send me your hacked version rob@websanova.com (also with the lib/*.js files).

@websanova
Copy link
Owner

One thing.... if you update the plugin manually, but only the main file and not the utils, that maybe an issue...

@websanova
Copy link
Owner

Ok, so this is working for you now?

@websanova
Copy link
Owner

Also, make sure you have the latest 1.3.0-beta, there have been some fixes and updates (for vue2 suppport as well).

@nshCore
Copy link
Author

nshCore commented Oct 28, 2016

i will update this and let you know

@websanova
Copy link
Owner

This should be well fixed in the latest 2.x stream as there are no longer any Vue objects being passed into the plugin.

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

No branches or pull requests

2 participants