You’re using an outdated version of the API. There is no step-by-step solution. It’s difficult/unsupported to use API v1.1 directly from client-side Javascript as was possible in API v1.1. You need to completely rethink your approach to a server-side solution using auth. There are many libraries you can find listed on this site that can help you with that.