# Access to the coroutine's context

**URL:** <https://discuss.kotlinlang.org/t/access-to-the-coroutines-context/4152>\
**Category:** Language Design\
**Created:** [August 11, 2017, 7:07pm UTC](https://discuss.kotlinlang.org/t/access-to-the-coroutines-context/4152 "2017-08-11T19:07:52Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![fvasco](https://sea1.discourse-cdn.com/flex019/user_avatar/discuss.kotlinlang.org/fvasco/32/1961_2.png) [@fvasco](https://discuss.kotlinlang.org/u/fvasco)\
**Post date:** [August 11, 2017, 7:07pm UTC](https://discuss.kotlinlang.org/t/access-to-the-coroutines-context/4152/1 "2017-08-11T19:07:52Z")

</div>

It’s pretty easy to access to current `Thread`, however coroutine’s context isn’t accessible and it requires definition of variable.

Should be possible to inject the current coroutine context in any `suspend` function putting it in the last parameter of CSP, this make easily possible some utility like `ThreadLocal`.

A webserver can inject some authentication parameters in the context and make it available to all call chain.

---

<div class="post-metadata">

**Author:** ![elizarov](https://sea1.discourse-cdn.com/flex019/user_avatar/discuss.kotlinlang.org/elizarov/32/2164_2.png) [@elizarov](https://discuss.kotlinlang.org/u/elizarov)\
**Post date:** [August 14, 2017, 8:51am UTC](https://discuss.kotlinlang.org/t/access-to-the-coroutines-context/4152/2 "2017-08-14T08:51:27Z")

</div>

The plan is have a top-level `val coroutineContext: CoroutineContext` that is available from any `suspend` function: [https://youtrack.jetbrains.com/issue/KT-17609](https://youtrack.jetbrains.com/issue/KT-17609)
