Log into site using Satellizer.js

Asked

Viewed 91 times

0

I need to make an application where the user can login through facebook and Soundcloud, and I found this https://github.com/sahat/satellizer to do this, and according to this page https://github.com/sahat/satellizer/issues/3 it is possible to do this with Soundcloud by Oauth2, but I cannot, I believe it is very close to the solution, because when using this code:

index.html

<md-button class="md-raised md-primary md-hue-2 btn-soundcloud" ng-click="authenticate('soundcloud')"></md-button>

controller js.

   .controller('LoginCtrl', function($scope, $auth) {
       $scope.authenticate = function(provider) {
         $auth.authenticate(provider);
       };
  });

config.js

    $authProvider.oauth2({
      name: 'soundcloud',
      url: 'https://soundcloud.com/connect',
      clientId: 'CLIENT_ID',
      redirectUri: window.location.origin + '/',
      authorizationEndpoint: 'https://api.soundcloud.com/oauth2/token',
      popupOptions: { width: 580, height: 400 }
    });

Opens a new window and returns the following error:

  {"errors":[{"error_message":"404 - Not Found"}]}

Has anyone ever logged in with Soundcloud? Or just if you can recommend someone else to do the same thing...

1 answer

0

I managed to solve my problem, just changed my config.js to this way:

    $authProvider.oauth2({
      name: 'soundcloud',
      url: '/auth/soundcloud',
      clientId: 'CLIENT_ID',
      responseType: 'code',
      redirectUri: window.location.origin + '/callback.html',
      authorizationEndpoint: 'https://soundcloud.com/connect',
      popupOptions: { width: 580, height: 400 }
    });

I believe the URL I was using in authorizationEndpoint was wrong.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.