Tools
Tools copied to clipboard
agora-token: Buffer is not defined
Hi,
for development purposes I am trying to generate token on client-side based on node package 'agora-token'. RTC (RtcTokenBuilder.buildTokenWithUid) code sample returning:
Uncaught ReferenceError: Buffer is not defined at is_uuid (AccessToken2.js:197:23)
regardless of the changes I make. I get same result even if I try to run code from agora-token/sample.js.
Slowly but surely it driving me nuts :) Am i missing something or it's just broken package/dependencies?
Thanks for help!
@iztokf Buffer is a default library provided by node.js it's not natively available on web browser. to use it in client side you will need to add an extra dependency try looking into this thread https://stackoverflow.com/questions/56237161/how-can-i-use-node-js-buffer-library-in-client-side-javascript