Forum Discussion

nerisa's avatar
nerisa
Contributor
4 years ago

Subscription API usage

I am trying to use the API described here: (https://developer.khoros.com/khoroscommunitydevdocs/docs/subscribe-to-community-events). This feature is already enabled on stage and production environments.

I created an admin user with the necessary API rights. I tried to authenticate this user using the sessions key option as described here: https://developer.khoros.com/khoroscommunitydevdocs/docs/session-key using postman. I got a 502 Bad Gateway response.

Do I need to enable CORS and whitelist IPs as described here: https://developer.khoros.com/khoroscommunitydevdocs/docs/getting-started-with-api-1 too? 

1 Reply

  • Hi,

    I have done the login call in an vuejs component like this:

    axios({
          method: 'get',
          url: '/restapi/vc/authentication/sessions/login',
          params: {
            'user.login': username,
            'user.password': password,
            'restapi.response_format': 'json'
          }
        })
        .then(response => {
          if (response.data.response.status == 'success') {
            this.authToken = response.data.response.value.$;
          }
        })

     

    Keep in mind that this will not work with users managed by an external IDP/Login system.