# Token request failed

**URL:** <https://forum.mattermost.com/t/token-request-failed/246>\
**Category:** Troubleshooting\
**Created:** [September 25, 2015, 7:46am UTC](https://forum.mattermost.com/t/token-request-failed/246 "2015-09-25T07:46:49Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![s14ck](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mattermost.com/s14ck/32/119_2.png) [@s14ck](https://forum.mattermost.com/u/s14ck)\
**Post date:** [September 25, 2015, 7:46am UTC](https://forum.mattermost.com/t/token-request-failed/246/1 "2015-09-25T07:46:49Z")

</div>

Hi,

I’ve been installed the last gitlab-mattermost and following step by step the howto to activate de SSO built in but I got this error:

```
> ==> /var/log/gitlab/gitlab-rails/production.log <==
> Started GET "/oauth/authorize?response_type=code&client_id=9476c971a4e9f31e507ad9cef2937d62c12808e5d2179e02f148dbfd4fe4590f&redirect_uri=https%3A%2F%2Fsland.tech%2Fsignup%2Fgitlab%2Fcomplete&state=eyJoYXNoIjoiJDJhJDEwJEJjQ25CREJSb1ZpZXI2YndrMjdGVS41MklXNkJFYmtna2wyVXNBbnBjRjF2dkpndTBFTy5lIiwidGVhbSI6ImFyZHVpbm8wMTIzNDU2Nzg5In0%3D" for 181.39.192.168 at 2015-09-25 02:32:04 -0500
> Processing by Oauth::AuthorizationsController#new as HTML
> Parameters: {"response_type"=>"code", "client_id"=>"9476c971a4e9f31e507ad9cef2937d62c12808e5d2179e02f148dbfd4fe4590f", "redirect_uri"=>"https://sland.tech/signup/gitlab/complete", "state"=>"eyJoYXNoIjoiJDJhJDEwJEJjQ25CREJSb1ZpZXI2YndrMjdGVS41MklXNkJFYmtna2wyVXNBbnBjRjF2dkpndTBFTy5lIiwidGVhbSI6ImFyZHVpbm8wMTIzNDU2Nzg5In0="}
> Completed 200 OK in 79ms (Views: 56.9ms | ActiveRecord: 12.2ms)
> Started POST "/oauth/authorize" for 181.39.192.168 at 2015-09-25 02:32:06 -0500
> Processing by Oauth::AuthorizationsController#create as HTML
> Parameters: {"utf8"=>"âœ“", "authenticity_token"=>"[FILTERED]", "client_id"=>"9476c971a4e9f31e507ad9cef2937d62c12808e5d2179e02f148dbfd4fe4590f", "redirect_uri"=>"https://sland.tech/signup/gitlab/complete", "state"=>"eyJoYXNoIjoiJDJhJDEwJEJjQ25CREJSb1ZpZXI2YndrMjdGVS41MklXNkJFYmtna2wyVXNBbnBjRjF2dkpndTBFTy5lIiwidGVhbSI6ImFyZHVpbm8wMTIzNDU2Nzg5In0=", "response_type"=>"code", "scope"=>"api"}
> Redirected to https://sland.tech/signup/gitlab/complete?code=0ef6ece6b75952874cf76b1eb96c2027c650924a360f9b257f7c69e5fd33c37d&state=eyJoYXNoIjoiJDJhJDEwJEJjQ25CREJSb1ZpZXI2YndrMjdGVS41MklXNkJFYmtna2wyVXNBbnBjRjF2dkpndTBFTy5lIiwidGVhbSI6ImFyZHVpbm8wMTIzNDU2Nzg5In0%3D
> Completed 302 Found in 19ms (ActiveRecord: 5.6ms)

```

> ```
> > ==> /var/log/gitlab/mattermost/current <==
> > 2015-09-25_07:32:06.47690 [09/25/15 02:32:06] [EROR] /signup/gitlab/complete:AuthorizeOAuthUser code=500 rid=6jbc5d83oin7pnq6mgp18w94ar uid= ip=181.39.192.168 Token request failed [details: Post https://git.sland.tech/oauth/token: x509: certificate is valid for rdi.sland.tech, sland.tech, not git.sland.tech]
> 
> ```

 ![](https://us1.discourse-cdn.com/flex020/uploads/mattermost/original/1X/a55dc6457e35df3b05045d480162b4a0b59fce7f.png)

Thanks in advance,

–  
Jhoanir Torres

---

<div class="post-metadata">

**Author:** ![it33](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mattermost.com/it33/32/3_2.png) [@it33](https://forum.mattermost.com/u/it33)\
**Post date:** [October 2, 2015, 7:08pm UTC](https://forum.mattermost.com/t/token-request-failed/246/2 "2015-10-02T19:08:08Z")

</div>

> [@s14ck](#):
>
> x509: certificate is valid for rdi.sland.tech, sland.tech, not git.sland.tech]

Sorry for delay, seems like certificate is not valid?

---

<div class="post-metadata">

**Author:** ![navnith](https://avatars.discourse-cdn.com/v4/letter/n/cc9497/32.png) [@navnith](https://forum.mattermost.com/u/navnith)\
**Post date:** [October 6, 2015, 8:59pm UTC](https://forum.mattermost.com/t/token-request-failed/246/3 "2015-10-06T20:59:51Z")

</div>

I get same message in my setup.  
I have hosted gitlab and mattermost in port 8000 and port 9000 on same server.  
I have enabled ssl and created one certificate/key for the server ip.

When I create a new Team in Mattermost, it redirects to gitlab for login. Once loggedin gitlab shows a screen to Authorize or deny. When I click the Authorize button, I get the message "GitLab Mattermost needs your help:Token request failed"  
Can any one help me to resolve this error?

---

<div class="post-metadata">

**Author:** ![probert](https://avatars.discourse-cdn.com/v4/letter/p/ecc23a/32.png) [@probert](https://forum.mattermost.com/u/probert)\
**Post date:** [May 5, 2016, 12:55pm UTC](https://forum.mattermost.com/t/token-request-failed/246/4 "2016-05-05T12:55:33Z")

</div>

I get the same error as you. No SSL setup in my case.

==\> /var/log/gitlab/gitlab-rails/production.log \<==  
Started POST “/oauth/authorize” for 127.0.0.1 at 2016-05-05 09:00:20 -0400  
Processing by Oauth::AuthorizationsController#create as HTML  
Parameters: {“utf8”=\>“✓”, “authenticity\_token”=\>"[FILTERED]", “client\_id”=\>“xxxxxx”, “redirect\_uri”=\>“[http://xxxxxx/signup/gitlab/complete](http://xxxxxx/signup/gitlab/complete)”, “state”=\>“xxxxx=”, “response\_type”=\>“code”, “scope”=\>“api”, “commit”=\>“Authorize”}  
Redirected to [http://xxxxxx/signup/gitlab/complete?code=xxx&state=xxxx%3D](http://xxxxxx/signup/gitlab/complete?code=xxx&state=xxxx%3D)  
Completed 302 Found in 13ms (ActiveRecord: 2.4ms)

==\> /var/log/gitlab/gitlab-workhorse/current \<==  
2016-05-05\_13:00:20.27512 migrationgit.druide @ - - [2016-05-05 09:00:20.252803743 -0400 EDT] “POST /oauth/authorize HTTP/1.1” 302 364 “[http://xxxx/oauth/authorize?response\_type=code&client\_id=xxxx&redirect\_uri=http%3A%2F%xxxxx%2Fsignup%2Fgitlab%2Fcomplete&state=xxxxx%3D](http://xxxx/oauth/authorize?response_type=code&client_id=xxxx&redirect_uri=http%3A%2F%25xxxxx%2Fsignup%2Fgitlab%2Fcomplete&state=xxxxx%3D)” “Mozilla/5.0 (Macintosh; Intel Mac OS X 10\_10\_5) AppleWebKit/601.5.17 (KHTML, like Gecko) Version/9.1 Safari/601.5.17” 0.022197

==\> /var/log/gitlab/nginx/gitlab\_access.log \<==  
192.168.1.155 - - [05/May/2016:09:00:20 -0400] “POST /oauth/authorize HTTP/1.1” 302 364 “[http://xxxx/oauth/authorize?response\_type=code&client\_id=xxxx&redirect\_uri=http%3A%2F%2Fmattermost.druide%2Fsignup%2Fgitlab%2Fcomplete&state=xxxxxx%3D](http://xxxx/oauth/authorize?response_type=code&client_id=xxxx&redirect_uri=http%3A%2F%2Fmattermost.druide%2Fsignup%2Fgitlab%2Fcomplete&state=xxxxxx%3D)” “Mozilla/5.0 (Macintosh; Intel Mac OS X 10\_10\_5) AppleWebKit/601.5.17 (KHTML, like Gecko) Version/9.1 Safari/601.5.17”

==\> /var/log/gitlab/mattermost/mattermost.log \<==  
[2016/05/05 09:00:20 EDT] [EROR] /signup/gitlab/complete:AuthorizeOAuthUser code=500 rid=xxxxxx uid= ip=192.168.1.155 Erreur lors de la récupération du jeton [details:]

==\> /var/log/gitlab/nginx/gitlab\_mattermost\_access.log \<==  
192.168.1.155 - - [05/May/2016:09:00:20 -0400] “GET /signup/gitlab/complete?code=xxxxx&state=xxxxxxx%3D HTTP/1.1” 500 1348 “[http://xxxxx/oauth/authorize?response\_type=code&client\_id=xxxxx&redirect\_uri=http%3A%2F%2Fmattermost.druide%2Fsignup%2Fgitlab%2Fcomplete&state=xxxxxx%3D](http://xxxxx/oauth/authorize?response_type=code&client_id=xxxxx&redirect_uri=http%3A%2F%2Fmattermost.druide%2Fsignup%2Fgitlab%2Fcomplete&state=xxxxxx%3D)” "Mozilla/5.0 (Macintosh; Intel Mac OS X 10\_10\_5) AppleWebKit/601.5.17 (KHTML, like Gecko) Version/9.1 Safari/601.5.17"  
192.168.1.155 - - [05/May/2016:09:00:20 -0400] “GET /static/js/react-with-addons-0.13.3.min.js HTTP/1.1” 404 19 “[http://mattermost.druide/signup/gitlab/complete?code=xxxx&state=xxxxx%3D](http://mattermost.druide/signup/gitlab/complete?code=xxxx&state=xxxxx%3D)” "Mozilla/5.0 (Macintosh; Intel Mac OS X 10\_10\_5) AppleWebKit/601.5.17 (KHTML, like Gecko) Version/9.1 Safari/601.5.17"  
192.168.1.155 - - [05/May/2016:09:00:20 -0400] “GET /static/js/react-bootstrap-0.25.1.min.js HTTP/1.1” 404 19 “[http://mattermost.druide/signup/gitlab/complete?code=xxxx&state=xxxx%3D](http://mattermost.druide/signup/gitlab/complete?code=xxxx&state=xxxx%3D)” "Mozilla/5.0 (Macintosh; Intel Mac OS X 10\_10\_5) AppleWebKit/601.5.17 (KHTML, like Gecko) Version/9.1 Safari/601.5.17"  
192.168.1.155 - - [05/May/2016:09:00:20 -0400] “GET /static/js/jquery-1.11.1.min.js HTTP/1.1” 404 19 “[http://mattermost.druide/signup/gitlab/complete?code=xxxxx&state=xxxx%3D](http://mattermost.druide/signup/gitlab/complete?code=xxxxx&state=xxxx%3D)” “Mozilla/5.0 (Macintosh; Intel Mac OS X 10\_10\_5) AppleWebKit/601.5.17 (KHTML, like Gecko) Version/9.1 Safari/601.5.17”
