Beispiel #1
0
	connectToSoundCloud: function() {
		// initiate auth popup
		SC.connect().then(function() {
			return SC.get('/me');
		}).then(function(me) {
			this.setState(Object.assign(this.state, {loggedUser: me, loggedIn: true}));
		}.bind(this));
	},
export function signIn() {
  // initiate auth popup
  SC.connect().then(function() {
    return SC.get('/me');
  })
    .then(function(me) {
      console.log("Logged in as " + me.username);
    });
}
Beispiel #3
0
export const auth = () => (dispatch) => {
  SC.initialize({ client_id: CLIENT_ID, redirect_uri: REDIRECT_URI });
  SC.connect().then((session) => {
    fetch(`//api.soundcloud.com/me?oauth_token=${session.oauth_token}`)
      .then((response) => response.json())
      .then((me) => {
        dispatch(setMe(me));
        dispatch(fetchStream(me, session));
      });
  });
};
Beispiel #4
0
  return (dispatch) => {
    SC.initialize({
      client_id: CLIENT_ID,
      redirect_uri: redirectURI
    })

    SC.connect().then((authObj) => {
      Cookies.set(COOKIE_PATH, authObj.oauth_token)
      dispatch(authUser(authObj.oauth_token, shouldShowStream))
    })
    .catch((err) => { throw err })
  }
Beispiel #5
0
  return dispatch => {
    SC.initialize({
      client_id: CLIENT_ID,
      redirect_uri: `${window.location.protocol}//${window.location.host}/api/callback`,
    });

    SC.connect().then(authObj => {
      Cookies.set(COOKIE_PATH, authObj.oauth_token);
      dispatch(authUser(authObj.oauth_token, shouldShowStream));
    })
    .catch(err => { throw err; });
  };
Beispiel #6
0
  return function(dispatch) {
    SC.initialize({
      client_id: CLIENT_ID,
      redirect_uri: REDIRECT_URI
    })

    SC.connect().then((session) => {
      fetch(`//api.soundcloud.com/me?oauth_token=${session.oauth_token}`)
        .then((response => response.json()))
        .then((me) => {
          dispatch(setMe(me))
          dispatch(fetchStream(me, session))
        })
    })
  }
Beispiel #7
0
  return (dispatch) => {
    // We initialize the Soundclound client using the client_id and the redirect uri
    SC.initialize({ client_id: CLIENT_ID, redirect_uri: REDIRECT_URI });

    // We connect to the client using our oauth_token
    SC.connect().then((session) => {
      fetch(`//api.soundcloud.com/me?oauth_token=${session.oauth_token}`)
          .then((response) => response.json())
          .then((user) => {
            // We dispatch an action that will save the user data
            dispatch(setMe(user));
            dispatch(fetchStream(user, session));
          });
    });
  };
 return (dispatch) => {
   SoundCloud.connect().then((session) => {
     dispatch(fetchMe(session));
     dispatch(fetchTracks(session));
   });
 }
Beispiel #9
0
export const authenticate = async () => {
  const session = await SC.connect()
  return session.oauth_token
}
 return function (dispatch) {
   SC.connect().then((session) => {
     dispatch(fetchMe(session));
     dispatch(fetchStream(session));
   });
 };