# Slim with token based api rest

**URL:** <https://discourse.slimframework.com/t/slim-with-token-based-api-rest/1882>\
**Category:** Questions\
**Created:** [October 12, 2017, 11:15am UTC](https://discourse.slimframework.com/t/slim-with-token-based-api-rest/1882 "2017-10-12T11:15:07Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![mlazzeri](https://avatars.discourse-cdn.com/v4/letter/m/a88e4f/32.png) [@mlazzeri](https://discourse.slimframework.com/u/mlazzeri)\
**Post date:** [October 12, 2017, 11:15am UTC](https://discourse.slimframework.com/t/slim-with-token-based-api-rest/1882/1 "2017-10-12T11:15:07Z")

</div>

Hello people!  
I want to make an api rest token based with authentication.  
Now, I am sending on the header of every request the user token in the authentication header, which is extremely dangerous because I am exposing the token, but I could not find anything according to my requeriments.  
The users are being stored in my database.  
Could anyone help me please?

---

<div class="post-metadata">

**Author:** ![ericciaparicio](https://avatars.discourse-cdn.com/v4/letter/e/7c8e57/32.png) [@ericciaparicio](https://discourse.slimframework.com/u/ericciaparicio)\
**Post date:** [November 15, 2017, 8:07pm UTC](https://discourse.slimframework.com/t/slim-with-token-based-api-rest/1882/2 "2017-11-15T20:07:15Z")

</div>

Hello! Could you solve it?

---

<div class="post-metadata">

**Author:** ![mlazzeri](https://avatars.discourse-cdn.com/v4/letter/m/a88e4f/32.png) [@mlazzeri](https://discourse.slimframework.com/u/mlazzeri)\
**Post date:** [January 8, 2018, 11:22pm UTC](https://discourse.slimframework.com/t/slim-with-token-based-api-rest/1882/3 "2018-01-08T23:22:05Z")

</div>

hello! no I couldn’t! ☹ could you help me?

---

<div class="post-metadata">

**Author:** ![odan](https://avatars.discourse-cdn.com/v4/letter/o/9de053/32.png) [@odan](https://discourse.slimframework.com/u/odan)\
**Post date:** [January 9, 2018, 3:09pm UTC](https://discourse.slimframework.com/t/slim-with-token-based-api-rest/1882/4 "2018-01-09T15:09:39Z")

</div>

If you are using an SSL connection (https), the token should not be a big problem (see JWT). Or do I misunderstand your question?

---

<div class="post-metadata">

**Author:** ![mlazzeri](https://avatars.discourse-cdn.com/v4/letter/m/a88e4f/32.png) [@mlazzeri](https://discourse.slimframework.com/u/mlazzeri)\
**Post date:** [January 20, 2018, 3:28pm UTC](https://discourse.slimframework.com/t/slim-with-token-based-api-rest/1882/5 "2018-01-20T15:28:25Z")

</div>

I’m not using https, I am trying to implement the code on thephpleague page using oauth2, but it seems I got lost in the way

---

<div class="post-metadata">

**Author:** ![odan](https://avatars.discourse-cdn.com/v4/letter/o/9de053/32.png) [@odan](https://discourse.slimframework.com/u/odan)\
**Post date:** [January 20, 2018, 4:17pm UTC](https://discourse.slimframework.com/t/slim-with-token-based-api-rest/1882/6 "2018-01-20T16:17:54Z")

</div>

Well, you should provide more context, example code and maybe a error message or so. Maybe this link is helpful:

> [@How to use OAuth 2?](http://discourse.slimframework.com/t/how-to-use-oauth-2/1061):
>
> Dear community, I don’t know how to add OAuth2 to Slim Framework.Or JWT Auth. It’s a REST API with json response, no html.
