sahat / satellizer

Token-based AngularJS Authentication
https://satellizer-sahat.rhcloud.com
MIT License
7.85k stars 1.13k forks source link

405 Method Not Allowed #471

Closed uiktiomasfeliz closed 9 years ago

uiktiomasfeliz commented 9 years ago

When i try to sign in facebook/google/twitter the response i got in console is like this:

POST http://myurl.amazonaws.com/auth/facebook 405 (Method Not Allowed) POST http://myurl.amazonaws.com/auth/google 405 (Method Not Allowed) POST http://myurl.amazonaws.com/auth/twitter 405 (Method Not Allowed) i use the config like in the example, using my id from facebook/google/twitter. All the callbacks set-up. Why i got this problem?

i try changing settings like:

   $authProvider.httpInterceptor = false;
   $authProvider.baseUrl = null;

XHR Preview: 405 Method Not Allowed Code: MethodNotAllowed Message: The specified method is not allowed against this resource. Method: POST ResourceType: OBJECT

xhr

aligajani commented 9 years ago

Post your code.

On Wed, Jul 8, 2015 at 10:53 AM, uiktiomasfeliz notifications@github.com wrote:

When i try to sign in facebook/google/twitter the response i got in console is like this: POST http://myurl.amazonaws.com/auth/facebook 405 (Method Not Allowed)

i use the config like in the example, using my id from facebook/google/twitter. All the callbacks set-up. Why i got this problem?

XHR Preview: 405 Method Not Allowed Code: MethodNotAllowed Message: The specified method is not allowed against this resource. Method: POST ResourceType: OBJECT RequestId: 0BE16FF5D968F81F HostId: yr4seBT7QhCihXr8uaICHKEQBxksh8/hLH4c7HuaostncRHRyh3+Ksz7n2z3yKqq4RQgVLE9Eo4=

— Reply to this email directly or view it on GitHub https://github.com/sahat/satellizer/issues/471.

Ali Gajani Founder at Mr. Geek www.mrgeek.me www.aligajani.com

uiktiomasfeliz commented 9 years ago

JS:

angular.module("app-login", ["angular-md5", "angular-jwt", "ngStorage","ui.router", "app-login.serviceLogin",'pascalprecht.translate','satellizer'])
.config(function($authProvider) {
  //$authProvider.httpInterceptor = false;
   //$authProvider.baseUrl = null;
  $authProvider.facebook({
    clientId: '460667114101638'
  });
  $authProvider.google({
    clientId: '556923975284-j1ng2rgb4g02j5c6v7pnmqc26oofc13n.apps.googleusercontent.com'
  });
  $authProvider.twitter({
    url: '/auth/twitter'
  });
  })
  .controller("loginController", loginController)

  function loginController($scope, $http, md5, jwtHelper, $localStorage, $timeout, factoryLogin, $state, $rootScope, $translate, $auth){

  $scope.authenticate = function(provider) {
      $auth.authenticate(provider)
       .then(function() {        
         alert("Ok");
         console.log($auth.getPayload());
       })
       .catch(function(response) {         
         alert("Error");
       });
    };
  }

HTML:

<html ng-app="app-login">
header.....
<body class="gray-bg" data-ng-controller="loginController" ng-cloak >

<button class="btn btn-block btn-facebook" ng-click="authenticate('facebook')">
  <i class="fa fa-facebook"></i> Sign in with Facebook  </button>
<button class="btn btn-block btn-google-plus" ng-click="authenticate('google')">
 <span class="fa fa-google"></span> Sign in with Google </button>
<button class="btn btn-block btn-twitter" ng-click="authenticate('twitter')">
   <i class="fa fa-twitter"></i> Sign in with Twitter  </button>

<!-- Angular App Script -->
    <script src="js/angular/angular.js"></script>
    <script src="js/ui-router/angular-ui-router.min.js"></script>
    <script src="js/plugins/oclazyload/dist/ocLazyLoad.min.js"></script>
    <script src="js/angular-translate/angular-translate.min.js"></script>

    <script src="js/controllers/login.js"></script>

<script src="js/jwt-decode.js"></script>

    <!-- TOASTR SCRIPT -->
    <script src="js/plugins/toastr/toastr.min.js"></script>
    <script src="js/translations/translations_login.js"></script>

    <script src="js/plugins/angular-md5/angular-md5.min.js"></script>
    <script src="js/plugins/angular-jwt/angular-jwt.min.js"></script>
    <script src="js/plugins/ngStorage/ngStorage.min.js"></script>
    <script src="js/services/serviceLogin.js"></script>

    <!-- jQuery and Bootstrap -->
    <script src="js/jquery/jquery-2.1.1.min.js"></script>
    <script src="js/plugins/satellizer/satellizer.js"></script>

    <!--Validations-->
    <script src="js/plugins/validate/validator.js"></script>

    <script src="js/loginDirective.js"></script>

</body>
</html>
aligajani commented 9 years ago

clientId: '556923975284-j1ng2rgb4g02j5c6v7pnmqc26oofc13n.apps.googleusercontent.com'

Isn't that just supposed to be the clientID instead of the complete URL?

On Wed, Jul 8, 2015 at 12:38 PM, uiktiomasfeliz notifications@github.com wrote:

JS:

angular.module("app-login", ["angular-md5", "angular-jwt", "ngStorage","ui.router", "app-login.serviceLogin",'pascalprecht.translate','satellizer']) .config(function($authProvider) { //$authProvider.httpInterceptor = false; $authProvider.baseUrl = null; $authProvider.facebook({ clientId: '460667114101638' }); $authProvider.google({ clientId: '556923975284-j1ng2rgb4g02j5c6v7pnmqc26oofc13n.apps.googleusercontent.com' }); $authProvider.twitter({ url: '/auth/twitter' }); }) .controller("loginController", loginController)

function loginController($scope, $http, md5, jwtHelper, $localStorage, $timeout, factoryLogin, $state, $rootScope, $translate, $auth){

$scope.authenticate = function(provider) { $auth.authenticate(provider) .then(function() { alert("Ok"); console.log($auth.getPayload()); }) .catch(function(response) { alert("Error"); }); }; }

HTML:

header..... ``` ``` ``` ```

— Reply to this email directly or view it on GitHub https://github.com/sahat/satellizer/issues/471#issuecomment-119547095.

Ali Gajani Founder at Mr. Geek www.mrgeek.me www.aligajani.com

uiktiomasfeliz commented 9 years ago

I got the popup to confirm. when i click accept when the error show's.

Failed to load resource: the server responded with a status of 405 (Method Not Allowed)

OR

POST http://myurl.amazonaws.com/auth/facebook 405 (Method Not Allowed)
POST http://myurl.amazonaws.com/auth/google 405 (Method Not Allowed)
POST http://myurl.amazonaws.com/auth/twitter 405 (Method Not Allowed)
This problem i have it with facebook login and twitter.

test

sahat commented 9 years ago

This is not a problem with Satellizer but with your web server not allowing POST requests.

uiktiomasfeliz commented 9 years ago

i was not sure about that, thank you sahat

shmarlya commented 8 years ago

have the same issue

athimannil commented 8 years ago

I am also facing the same issue, Is there any solution for the issue ?

vishad-jain commented 7 years ago

@sahat I am facing the same issue and I don't think it is blocked by my server. This is due to some other issue. Please revert soon if possible