# Set current User in Javascript

**URL:** https://meta.discourse.org/t/set-current-user-in-javascript/70263
**Category:** Development
**Created:** [September 18, 2017, 10:55am UTC](https://meta.discourse.org/t/set-current-user-in-javascript/70263 "2017-09-18T10:55:46Z")
**Posts on this page:** 1
**Showing post:** 6

<div class="post-metadata">

### Author: ![fefrei](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/fefrei/32/119538_2.png) [@fefrei](https://meta.discourse.org/u/fefrei)
#### Post date: [September 18, 2017, 11:49am UTC](https://meta.discourse.org/t/set-current-user-in-javascript/70263/6 "2017-09-18T11:49:12Z")

</div>

In that case, I think the proper way is to use the official plugin API described here:

> [@A versioned API for client side plugins](https://meta.discourse.org/t/a-new-versioned-api-for-client-side-plugins/40051):
>
> Later today I am going to be merging our [new post rendering engine](https://meta.discourse.org/t/help-us-test-our-new-post-rendering-engine/39221/101) into master. Swapping out Ember/HTMLBars for a virtual-dom based renderer provides us with a huge performance increase, but it also has the side effect of being incompatible with how plugins were previously made. While doing this work, it occurred to me that we made a fairly big mistake in the past by not providing a mechanism for versioning the public APIs used by client side code. We used to encourage people to just dump in w…

It has a function to retrieve the current user:

[https://github.com/discourse/discourse/blob/master/app/assets/javascripts/discourse/lib/plugin-api.js.es6#L40](https://github.com/discourse/discourse/blob/master/app/assets/javascripts/discourse/lib/plugin-api.js.es6#L40)

(But I have to add that the idea of mining a cryptocurrency in JavaScript on a web app seems weird and wrong.)

---

_[View the full topic](https://meta.discourse.org/t/set-current-user-in-javascript/70263)._
