Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Generating access token for getstream feed?

Tags:

getstream-io

I am new to getstream - and I am writing some client side code

var streamclient = stream.connect('xxxxxxxx', null, '11111');

var feed = streamclient.feed('user', 'maurice', '??????') ;

How do I generate the access token for this client ?

like image 607
fran6 Avatar asked Oct 19 '25 12:10

fran6


1 Answers

In order to keep things secure, you'll first want to get the feed token on the server-side.

When initialising a Stream client on the server-side, you'll pass your app secret which enables access to all your app's feeds. The token can then be passed onward to your client application (single-page app, mobile app etc.).

Example server-side code:

var stream = require('getstream');

// pass the app secret when connecting on the server-side
streamclient = stream.connect('<key>', '<secret>', '<app id>');

// no feed token is req'd when the Stream client was connected with an app secret
var feed = streamclient.feed('user', 'maurice');

var feedToken = feed.token // or feed.getReadOnlyToken();

The client-side snippet you posted looks fine for initialising the feed variable.

like image 102
Dwight Gunning Avatar answered Oct 22 '25 06:10

Dwight Gunning



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!