authentication ⇒ Weavy.plugins.authentication
Plugin for signing in and out
Kind: global pluginInstance members
weavy.nodes ⇐ weavy.nodes
weavy.nodes.authenticationPanel : Element
Panel displaying the authentication page
Kind: instance property ofweavy.nodes
Created: Widget event: build
weavy.nodes.authenticationFrame : FrameElement
Frame for the authenticationPanel
Kind: instance property ofweavy.nodes
Created: Widget event: build
weavy.signIn([username], [password]) ⇒ Promise
Open the sign-in page. An authentication attempt is started if credentials are provided.
Kind: instance method ofauthentication
Emits:
weavy.signed-in
, weavy.authentication-error
Resolves:
true
- On successful sign-inResolves:
false
- On authentication errorParam | Type |
---|---|
[username] | string
|
[password] | string
|
// Open the sign in panel and wait for the user to complete authentication
weavy.signIn().then(function(signedIn) {
if (signedIn) {
weavy.log("User has signed in");
} else {
weavy.warn("User sign-in failed");
}
});
weavy.signOut() ⇒ Promise
Sign out from Weavy regardless of authentication provider
Kind: instance method ofauthentication
Emits:
weavy.signed-out
Resolves: When sign-out is completed
Example
// Sign out the active user
weavy.signOut().then(function() {
// Open the sign in page
weavy.signIn();
});
Properties
weavy.userState : string
Current authentication state of the user
- "signing-in" - The user is trying to sign in. See Widget event: signing-in
- "signed-in" - The user is signed in. See Widget event: signed-in
- "signing-out" - The user has started the sign-out process. See Widget event: signing-out
- "signed-out" - The user is not authenticated. See Widget event: signed-out and authentication-error
authentication
Default:
"signed-out"
Category: properties
weavy.signInUrl : url
weavy.signOutUrl : url
Static members
.defaults : Object
Default plugin options
Kind: static property ofauthentication
Properties
Name | Type | Default | Description |
---|---|---|---|
redirect | string
| "/notify" | URL to redirect to after signing in or out |
frameClassName | string
| Classes added to the class-property of authenticationFrame |
|
frameName | string
| "authentication" | Name used for the authentication panel |
Weavy.plugins.authentication.defaults = {
redirect: '/notify',
frameClassName: "",
frameName: "authentication"
};