简体   繁体   中英

Angular $http changing url on Rails Devise

This is my first ever stack overflow question because google usually sorts me out. However I can't seem to find anything/anyone online replicating my issue.

I'm using the Angular Devise module and when I attempt a login with the following URL

test.aam.tunnel.logicsaas-development.com:3000/users/sign_in.json

$http or Devise changes it to

http://undefined:undefinedtest.aam.tunnel.logicsaas-development.com:3000/users/sign_in.json

here is my config code:

AuthInterceptProvider.interceptAuth(true);

AuthProvider.loginPath('test.aam.tunnel.logicsaas-development.com:3000/users/sign_in.json');
AuthProvider.loginMethod('POST');
AuthProvider.resourceName('users');

And my login call:

var credentials = {
    email: 'user@domain.com',
    password: 'password1'
};

Auth.login(credentials).then(function(user) {
    console.log(user); // => {id: 1, ect: '...'}
}, function(error) {
    console.log(error)
    // Authentication failed...
});

I dug into devise and im 99% sure this is happening with $http. Any help at all would be much appreciated

Maybe you must change your host configuration with something like this:

 .config(function(AuthProvider){ AuthProvider.baseUrl("http://test.aam.tunnel.logicsaas-development.com:3000"); }) 

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM