api-console-assets
Version:
This repo only exists to publish api console components to npm
118 lines (109 loc) • 4.99 kB
HTML
<!--
@license
Copyright (c) 2015 The Polymer Project Authors. All rights reserved.
This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt
The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt
The complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt
Code distributed by Google as part of the polymer project is also
subject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt
-->
<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>auth-methods 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="../../arc-demo-helpers/arc-demo-snippet.html">
<link rel="import" href="../../oauth-authorization/oauth1-authorization.html">
<link rel="import" href="../../paper-toast/paper-toast.html">
<link rel="import" href="../auth-methods.html">
<!-- <iron-meta key="auth-proxy" value="http://localhost:5050/"></iron-meta> -->
<style is="custom-style" include="demo-pages-shared-styles">
:root {
font-size: 65%;
--form-label: {
font-weight: 500;
}
}
.vertical-section-container {
max-width: 600px;
}
output {
white-space: pre-wrap;
}
auth-method-oauth1 {
margin-bottom: 40px;
}
</style>
</head>
<body unresolved>
<oauth1-authorization></oauth1-authorization>
<div class="vertical-section-container centered">
<h3>The `auth-method-oauth1`</h3>
<h4>ARC echo endpoint</h4>
<arc-demo-snippet>
<template>
<auth-method-oauth1 id="method1"
consumer-key="key"
consumer-secret="secret"
redirect-url="http://127.0.0.1:8081/components/oauth-authorization/oauth-popup.html"
request-token-url="https://echo.advancedrestclient.com/auth/oauth1/request_token"
access-token-url="https://echo.advancedrestclient.com/auth/oauth1/access_token"
authorization-url="https://echo.advancedrestclient.com/auth/oauth1/dialog/authorize"></auth-method-oauth1>
<output id="log1"></output>
<script>
var provider = document.getElementById('method1');
var output = document.getElementById('log1');
provider.addEventListener('error', function(e) {
this.innerHTML += e.detail.error.message + '\n';
}.bind(output));
provider.addEventListener('auth-settings-changed', function(e) {
var text = 'Current settings:\n';
var data = JSON.stringify(e.detail, null, 2);
text += data + '\n';
this.innerHTML = text;
}.bind(output));
</script>
</template>
</arc-demo-snippet>
<h4>Twitter</h4>
<arc-demo-snippet>
<template>
<auth-method-oauth1 id="method2" consumer-key="ArgLwGXbBnk8K5ViAmqELOjmc" consumer-secret="W4yfjeCMLVgKmHhJAw3brNDqSeuJdddAoh0I7dkfMoy8nhEOV7" redirect-url="http://192.168.1.16:8081/components/auth-methods/demo/oauth1.html" request-token-url="https://api.twitter.com/oauth/request_token" access-token-url="https://api.twitter.com/oauth/access_token"></auth-method-oauth1>
<output id="log2"></output>
<script>
var provider = document.getElementById('method2');
var output = document.getElementById('log2');
provider.addEventListener('error', function(e) {
this.innerHTML += e.detail.error.message + '\n';
}.bind(output));
provider.addEventListener('auth-settings-changed', function(e) {
var text = 'Current settings:\n';
var data = JSON.stringify(e.detail, null, 2);
text += data + '\n';
this.innerHTML = text;
}.bind(output));
</script>
</template>
</arc-demo-snippet>
<h4>http://term.ie/oauth/example/</h4>
<arc-demo-snippet>
<template>
<auth-method-oauth1 consumer-key="key" consumer-secret="secret" redirect-url="http://192.168.1.16:8081/components/auth-methods/demo/oauth1.html" request-token-url="http://term.ie/oauth/example/request_token.php" access-token-url="http://term.ie/oauth/example/access_token.php" auth-token-method="GET" auth-params-location="querystring"></auth-method-oauth1>
</template>
</arc-demo-snippet>
<paper-toast text="" id="tokenToast"></paper-toast>
<script>
window.addEventListener('oauth1-token-response', function(e) {
var toast = document.getElementById('tokenToast');
toast.text = 'OAuth1 access token: ' + e.detail.oauth_token +
'. Token secret: ' + e.detail.oauth_token_secret;
toast.opened = true;
});
</script>
</div>
</body>
</html>