{"action":"created","issue":{"url":"https://api.github.com/repos/swagger-api/swagger-ui/issues/1384","labels_url":"https://api.github.com/repos/swagger-api/swagger-ui/issues/1384/labels{/name}","comments_url":"https://api.github.com/repos/swagger-api/swagger-ui/issues/1384/comments","events_url":"https://api.github.com/repos/swagger-api/swagger-ui/issues/1384/events","html_url":"https://github.com/swagger-api/swagger-ui/issues/1384","id":89606416,"number":1384,"title":"OAuth2 flow not completing","user":{"login":"lucian303","id":288151,"avatar_url":"https://avatars.githubusercontent.com/u/288151?v=3","gravatar_id":"","url":"https://api.github.com/users/lucian303","html_url":"https://github.com/lucian303","followers_url":"https://api.github.com/users/lucian303/followers","following_url":"https://api.github.com/users/lucian303/following{/other_user}","gists_url":"https://api.github.com/users/lucian303/gists{/gist_id}","starred_url":"https://api.github.com/users/lucian303/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/lucian303/subscriptions","organizations_url":"https://api.github.com/users/lucian303/orgs","repos_url":"https://api.github.com/users/lucian303/repos","events_url":"https://api.github.com/users/lucian303/events{/privacy}","received_events_url":"https://api.github.com/users/lucian303/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2015-06-19T16:31:11Z","updated_at":"2015-06-21T10:07:05Z","closed_at":null,"body":"I have the following config:\r\n\r\n```\r\nsecurityDefinitions:\r\n  oauth2:\r\n    type: oauth2\r\n    flow: accessCode\r\n    description: OAuth2 Security\r\n    tokenUrl: \"https://myserver.com/token\"\r\n    authorizationUrl: \"https://myserver.com/authorize\"\r\n    scopes:\r\n      read: Read data.\r\n```\r\n\r\nThe URLs are valid. When I click the On/Off switch, I get asked for the scope. I pick the only scope we have and click 'Authorize.' I get redirected to my oAuth login where I log in with valid credentials. I get redirected back to o2c.html with the proper oAuth code. That code calls ```window.opener.processOAuthCode(qp);``` then closes the window. Swagger UI then calls the /token endpoint but doesn't provide the client secret. This is where the flow fails.  \r\n\r\nWhich I suppose is to be expected because this block in index.html makes no sense:\r\n\r\n```\r\n            initOAuth({\r\n              clientId: \"swagger\",\r\n              realm: \"your-realms\",\r\n              appName: \"your-app-name\"\r\n            });\r\n```\r\n\r\nThe clientId is correct and it's set up correctly to redirect back to o2c.html. I have no idea what realm and appName are supposed to be or how they'd relate to oAuth in this case. I also tried using the implicit oAuth flow but had no luck with that as I don't think our server supports it.\r\n\r\nSo my questions:\r\n1) Can I authenticate with oAuth2 and if so what needs to be done to make the flow finish properly?\r\n2) Even when manually adding the appropriate Authorization header in the JS using ```          swaggerUi.api.clientAuthorizations.add(\"key\", new SwaggerClient.ApiKeyAuthorization(\"Authorization\", \"Bearer some_hash_here\", \"header\"));``` the API fails to make the call with this header. It's displayed in the curl call which works perfectly using curl so it's not an issue with the API itself but swagger. This is my fallback position for allowing testing of the oAuth2 API if #1 above doesn't work, assuming that swagger-ui can be made to actually send the headers properly."},"comment":{"url":"https://api.github.com/repos/swagger-api/swagger-ui/issues/comments/113881462","html_url":"https://github.com/swagger-api/swagger-ui/issues/1384#issuecomment-113881462","issue_url":"https://api.github.com/repos/swagger-api/swagger-ui/issues/1384","id":113881462,"user":{"login":"webron","id":241629,"avatar_url":"https://avatars.githubusercontent.com/u/241629?v=3","gravatar_id":"","url":"https://api.github.com/users/webron","html_url":"https://github.com/webron","followers_url":"https://api.github.com/users/webron/followers","following_url":"https://api.github.com/users/webron/following{/other_user}","gists_url":"https://api.github.com/users/webron/gists{/gist_id}","starred_url":"https://api.github.com/users/webron/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/webron/subscriptions","organizations_url":"https://api.github.com/users/webron/orgs","repos_url":"https://api.github.com/users/webron/repos","events_url":"https://api.github.com/users/webron/events{/privacy}","received_events_url":"https://api.github.com/users/webron/received_events","type":"User","site_admin":false},"created_at":"2015-06-21T10:07:05Z","updated_at":"2015-06-21T10:07:05Z","body":"Which version of the UI do you use?"}}