UNPKG

api-console-assets

Version:

This repo only exists to publish api console components to npm

101 lines (87 loc) 3.45 kB
<!doctype html> <!-- @license Copyright 2016 The Advanced REST client authors <arc@mulesoft.com> Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. --> <html> <head> <meta charset="utf-8"> <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"> <meta name="viewport" content="width=device-width, minimum-scale=1.0, initial-scale=1, user-scalable=yes"> <title>authorization-panel demo</title> <script src="../../webcomponentsjs/webcomponents-lite.js"></script> <link rel="import" href="../../iron-demo-helpers/demo-pages-shared-styles.html"> <link rel="import" href="../../iron-demo-helpers/demo-snippet.html"> <link rel="import" href="../../paper-styles/typography.html"> <link rel="import" href="../../oauth-authorization/oauth2-authorization.html"> <link rel="import" href="../../oauth-authorization/oauth1-authorization.html"> <link rel="import" href="../../iron-meta/iron-meta.html"> <link rel="import" href="../authorization-panel.html"> <style is="custom-style" include="demo-pages-shared-styles"> :root { --arc-font-body1: { @apply(--paper-font-body1); } --accent-color: #FF5040; } .vertical-section-container { max-width: 600px; } output { white-space: pre-wrap; word-break: break-all; display: block; margin: 12px 0; } #settings { margin-top: 40px; } </style> </head> <body unresolved> <div class="vertical-section-container centered"> <h3>The `authorization-panel`</h3> <demo-snippet> <template> <iron-meta key="auth-methods" value='[null, "basic", "oauth1", "oauth2"]'></iron-meta> <authorization-panel></authorization-panel> <oauth2-authorization></oauth2-authorization> <oauth1-authorization></oauth1-authorization> <output id="settings"></output> <output id="state"></output> <script> var redirectUrl = location.href.replace(/authorization-panel\/demo\/(basic\.html)?/, 'oauth-authorization/oauth-popup.html'); var panel = document.querySelector('authorization-panel'); panel.redirectUrl = redirectUrl; panel.addEventListener('authorization-settings-changed', function(e) { var data = e.detail; var output = document.querySelector('#settings'); if (!data.settings) { output.innerHTML = ''; } else { var txt = 'Authorization type: ' + data.type + '\n\n'; txt += JSON.stringify(data.settings, null, 2); output.innerHTML = txt; } }); panel.addEventListener('authorization-type-changed', function(e) { var type = e.detail.type; var output = document.querySelector('#state'); output.innerHTML += 'Selected ' + type + ' authorization method\n'; }); </script> </template> </demo-snippet> </div> </body> </html>