{"action":"created","issue":{"url":"https://api.github.com/repos/mattermost/platform/issues/6489","repository_url":"https://api.github.com/repos/mattermost/platform","labels_url":"https://api.github.com/repos/mattermost/platform/issues/6489/labels{/name}","comments_url":"https://api.github.com/repos/mattermost/platform/issues/6489/comments","events_url":"https://api.github.com/repos/mattermost/platform/issues/6489/events","html_url":"https://github.com/mattermost/platform/issues/6489","id":231078253,"number":6489,"title":"OAuth2 Failure with Gitlab — Bad Token Type","user":{"login":"kkirsche","id":947110,"avatar_url":"https://avatars2.githubusercontent.com/u/947110?v=3","gravatar_id":"","url":"https://api.github.com/users/kkirsche","html_url":"https://github.com/kkirsche","followers_url":"https://api.github.com/users/kkirsche/followers","following_url":"https://api.github.com/users/kkirsche/following{/other_user}","gists_url":"https://api.github.com/users/kkirsche/gists{/gist_id}","starred_url":"https://api.github.com/users/kkirsche/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kkirsche/subscriptions","organizations_url":"https://api.github.com/users/kkirsche/orgs","repos_url":"https://api.github.com/users/kkirsche/repos","events_url":"https://api.github.com/users/kkirsche/events{/privacy}","received_events_url":"https://api.github.com/users/kkirsche/received_events","type":"User","site_admin":false},"labels":[{"id":250215067,"url":"https://api.github.com/repos/mattermost/platform/labels/Awaiting%20Submitter%20Action","name":"Awaiting Submitter Action","color":"b60205","default":false}],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":2,"created_at":"2017-05-24T15:22:25Z","updated_at":"2017-05-24T16:58:59Z","closed_at":null,"body":"#### Summary\r\nGitlab 9.2.1 responds to SSO OAuth request and a 500 Error — Bad Token Type is displayed to the user\r\n\r\n#### Steps to reproduce\r\n1. Login to Mattermost 3.9.0\r\n2. Login to Gitlab 9.2.1\r\n3. Navigate in Gitlab to Admin Area > Applications and click create new application\r\n4. Input in create new application within Gitlab two callback URLS, https://<root URL>/login/gitlab/complete and https://<root URL>/signup/gitlab/complete\r\n5. Save Application\r\n6. Navigate in Mattermost to the system console\r\n7. Navigate to Authentication > Gitlab\r\n8. Enable authentication with Gitlab\r\n9. Enter the Application ID and Application Secret\r\n10. Enter the API endpoints `https://<gitlab url>/api/v3/user`, `https://<gitlab url>/oauth/authorize`, `https://<gitlab url>/oauth/token`\r\n11. Click save configuration in Gitlab\r\n\r\nEasiest way to then test the issue\r\n12. As the admin user, navigate in Mattermost to Account Settings > Security\r\n13. Click Sign-In Method and click Switch to using Gitlab SSO\r\n14. Enter Gitlab password SSO and click Switch Account to Gitlab SSO\r\n15. Click Authorize\r\n16. Receive error JSON `{\"id\":\"api.user.authorize_oauth_user.bad_token.app_error\",\"message\":\"Bad token type\",\"detailed_error\":\"\",\"request_id\":\"d7n8de14qprozff7nrgs4reasr\",\"status_code\":500}`\r\n\r\n#### Expected behavior\r\nSSO would receive a valid token and create the user or change the authentication method\r\n\r\n#### Observed behavior\r\nReceived:\r\n\r\n    {\"id\":\"api.user.authorize_oauth_user.bad_token.app_error\",\"message\":\"Bad token type\",\"detailed_error\":\"\",\"request_id\":\"wadpeoo9bpn5ip69w5xc7qf7ic\",\"status_code\":500}\r\n\r\nAfter getting the authorize Gitlab page\r\n\r\n#### Possible fixes\r\nAround\r\nhttps://github.com/mattermost/platform/blob/5f9a28ed6f45dd02a0aa2b4220717c29567a7ba8/app/oauth.go#L603-L605"},"comment":{"url":"https://api.github.com/repos/mattermost/platform/issues/comments/303786785","html_url":"https://github.com/mattermost/platform/issues/6489#issuecomment-303786785","issue_url":"https://api.github.com/repos/mattermost/platform/issues/6489","id":303786785,"user":{"login":"kkirsche","id":947110,"avatar_url":"https://avatars2.githubusercontent.com/u/947110?v=3","gravatar_id":"","url":"https://api.github.com/users/kkirsche","html_url":"https://github.com/kkirsche","followers_url":"https://api.github.com/users/kkirsche/followers","following_url":"https://api.github.com/users/kkirsche/following{/other_user}","gists_url":"https://api.github.com/users/kkirsche/gists{/gist_id}","starred_url":"https://api.github.com/users/kkirsche/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kkirsche/subscriptions","organizations_url":"https://api.github.com/users/kkirsche/orgs","repos_url":"https://api.github.com/users/kkirsche/repos","events_url":"https://api.github.com/users/kkirsche/events{/privacy}","received_events_url":"https://api.github.com/users/kkirsche/received_events","type":"User","site_admin":false},"created_at":"2017-05-24T16:58:59Z","updated_at":"2017-05-24T16:58:59Z","body":"Oh, and here's the page where it's configured \r\n![screen-shot-2017-05-24-at-12 54 51-pm](https://cloud.githubusercontent.com/assets/947110/26415519/bf84cf06-4080-11e7-98f0-1867a02f5a6d.jpg)\r\n"}}
{"actor":{"display_login":"kkirsche"}}