api-console-assets
Version:
This repo only exists to publish api console components to npm
95 lines (88 loc) • 4.89 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/oauth2-authorization.html">
<link rel="import" href="../../paper-toggle-button/paper-toggle-button.html">
<link rel="import" href="../../iron-meta/iron-meta.html">
<link rel="import" href="../auth-methods.html">
<style is="custom-style" include="demo-pages-shared-styles">
:root {
--form-label: {
font-weight: 500;
}
}
.vertical-section-container {
max-width: 600px;
}
output {
white-space: pre-wrap;
margin-top: 20px;
}
auth-method-oauth2 {
margin-bottom: 40px;
}
</style>
</head>
<body unresolved>
<div class="vertical-section-container centered">
<h3>The `auth-method-oauth2`</h3>
<arc-demo-snippet userscopes='["email","profile"]' scopes='["user", "profile", "https://www.googleapis.com/auth/analytics.readonly", "https://www.googleapis.com/auth/bigquery", "https://www.googleapis.com/auth/cloud-platform", "https://www.googleapis.com/auth/devstorage.read_only", "https://www.googleapis.com/auth/blogger.readonly", "https://www.googleapis.com/auth/calendar.readonly", "https://www.googleapis.com/auth/cloud-platform", "https://www.googleapis.com/auth/compute", "https://www.googleapis.com/auth/drive", "https://www.googleapis.com/auth/firebase", "https://www.googleapis.com/auth/fitness.activity.read", "https://www.googleapis.com/auth/fitness.body.read", "https://www.googleapis.com/auth/fitness.location.read", "https://www.googleapis.com/auth/fitness.nutrition.read", "https://www.googleapis.com/auth/games", "https://www.googleapis.com/auth/plus.login", "https://www.googleapis.com/auth/gmail.readonly", "https://www.googleapis.com/auth/plus.me", "openid", "https://www.googleapis.com/auth/contacts.readonly", "https://www.googleapis.com/auth/user.addresses.read", "https://www.googleapis.com/auth/user.emails.read", "https://www.googleapis.com/auth/user.birthday.read","https://www.googleapis.com/auth/user.phonenumbers.read"]'>
<template>
<auth-method-oauth2
access-token-url="https://www.googleapis.com/oauth2/v4/token"
client-secret="hmhUZi8NaHmuFkmrPUwHzt7W"
scopes="[[userscopes]]"
allowed-scopes="[[scopes]]"
client-id="821776164331-rserncqpdsq32lmbf5cfeolgcoujb6fm.apps.googleusercontent.com"
auth-url="https://accounts.google.com/o/oauth2/v2/auth"
grant-type="implicit"
no-stepper="[[noStepper]]"
no-grant-type="[[noGrantType]]"
step-start-index="0"></auth-method-oauth2>
<oauth2-authorization></oauth2-authorization>
<paper-toggle-button checked="{{noStepper}}">Hide stepper</paper-toggle-button>
<paper-toggle-button checked="{{noGrantType}}">Hide grant type selector</paper-toggle-button>
<output id="log"></output>
<script>
var providers = document.querySelectorAll('auth-method-oauth2');
var redirectUrl = location.href.replace('/auth-methods/demo/oauth2.html',
'/oauth-authorization/oauth-popup.html');
var output = document.querySelector('output');
providers.forEach(function(provider) {
provider.redirectUrl = redirectUrl;
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>
<h3>Element without data</h3>
<arc-demo-snippet>
<auth-method-oauth2></auth-method-oauth2>
</arc-demo-snippet>
</div>
</body>
</html>