3

Trying to get realtime feed from getstream.io, but getting error saying "CORS request rejected: https://api.stream-io-api.com/api/v1.0/feed/user/..."

Following is my javascript code and Key,APP_ID and ReadOnlyToken is provided correctly.

        var stream = require('getstream');
        var client = stream.connect({{Key}}, null, {{APP_ID}});
        var user = client.feed('user', 511,{{ReadOnlyToken}});
        user.get({ limit:20, offset:0 })
        .then(function(response){
                console.log(response);
         })
        .catch(function(error){
                console.log(error);
         });

What do I need to do to make it work. I want to show users post in realtime at newsfeed. I'm using laravel as backened, and that was working fine and I'm able to get feeds from Feed Manager.

FeedManager::getUserFeed($user_id)->getActivities(0,25)['results'];

This is providing the user's feed but I need to implement realtime via javascript in VueJS.

enter image description here

K Ravi
  • 729
  • 8
  • 25

1 Answers1

2

Problem was I was using older browser working good with new browsers. Also if you used wrong read only token then also CORS error will appear.

K Ravi
  • 729
  • 8
  • 25
  • Indeed we have minor edge-case bug where incorrect tokens that return a 403 do include the appropriate `access-control-allow-origin` headers. This causes a CORS error in the browser which distracts from the more significant token / auth problem which needs to be fixed within the app. – Dwight Gunning Mar 28 '18 at 05:50