Jian Li | 1c94b9d | 2017-02-08 15:47:21 +0900 | [diff] [blame] | 1 | <script> |
| 2 | var qp = null; |
| 3 | if(/code|token|error/.test(window.location.hash)) { |
| 4 | qp = location.hash.substring(1); |
| 5 | } |
| 6 | else { |
| 7 | qp = location.search.substring(1); |
| 8 | } |
| 9 | qp = qp ? JSON.parse('{"' + qp.replace(/&/g, '","').replace(/=/g,'":"') + '"}', |
| 10 | function(key, value) { |
| 11 | return key===""?value:decodeURIComponent(value) } |
| 12 | ):{} |
| 13 | |
| 14 | if (window.opener.swaggerUiAuth.tokenUrl) |
| 15 | window.opener.processOAuthCode(qp); |
| 16 | else |
| 17 | window.opener.onOAuthComplete(qp); |
| 18 | |
| 19 | window.close(); |
| 20 | </script> |