-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathauth0-link-account.html
57 lines (48 loc) · 1.22 KB
/
auth0-link-account.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
<link rel="import" href="../polymer/polymer-element.html">
<link rel="import" href="auth0.html">
<dom-module id="auth0-link-account">
<template>
</template>
<script>
class Auth0LinkAccount extends Polymer.Element {
static get is() {
return 'auth0-link-account'
}
static get properties() {
return {
connection: {
type: String,
notify: true
},
clientId: {
type: String
},
domain: {
type: String
},
options: {
type: Object
}
}
}
static get observers() {
return [
'_initAccountLinking(connection)'
]
}
_initAccountLinking(connection) {
if (!connection) {
return
}
localStorage.setItem('auth0:link-account', connection);
var webAuth = new auth0.WebAuth({
domain: this.domain,
clientID: this.clientId
});
var options = Object.assign({}, this.options, {connection: this.connection});
webAuth.authorize(options);
}
}
customElements.define(Auth0LinkAccount.is, Auth0LinkAccount);
</script>
</dom-module>