Features

Quickstart

Html

        
<div id="my-app"></div>
        
      

Javascript

        
Volie.Connect.UI.mount(
  {id: "#my-app"},
  {
    tokenHandler: function(oldKey, accept) {
      fetch("http://volie-api.dev.me/connect/dev_capability_token",
      { 
        method: "POST"
      }).then(function(result) {
        result.json().then(function(x) { accept(x.token); })
      });
    },
  },
);
        
      

Server side token generation

Create a capability token using your volie connect key. Token must be signed using hmac using your volie connect secret-key. If a user key is provided it will be linked to a volie user. If an email is provided it will match a user against the system and link the session to that.

        
var connectKey = getConnectKey()
claims := NewCapabilityToken()
claims.AccessKey = connectKey.AccessKey
claims.OrganizationKey = organization.OrganizationKey
claims.UserKey = currentUser.UserKey
claims.ExpiresAt = time.Now().Add(4 * time.Hour).Unix()
claims.IssuedAt = time.Now().Unix()
jwtToken := jwt.NewWithClaims(jwt.SigningMethodHS256, claims)
token, err = jwtToken.SignedString([]byte(connectKey.SecretKey))
if err != nil {
	log.Error.Printf("Error signing token: %s", err)
}
return token, err
        
      

Demo

Docs