aboutsummaryrefslogtreecommitdiffstats
path: root/plugins/mod_tokenauth.lua
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/mod_tokenauth.lua')
-rw-r--r--plugins/mod_tokenauth.lua5
1 files changed, 4 insertions, 1 deletions
diff --git a/plugins/mod_tokenauth.lua b/plugins/mod_tokenauth.lua
index 86f9a3bd..3661d8bf 100644
--- a/plugins/mod_tokenauth.lua
+++ b/plugins/mod_tokenauth.lua
@@ -54,10 +54,13 @@ function create_jid_token(actor_jid, token_jid, token_role, token_ttl, token_dat
local token_secret = random.bytes(18);
local token = "secret-token:"..base64.encode("2;"..token_id..";"..token_secret..";"..jid.join(token_username, token_host));
- token_store:set(token_username, token_id, {
+ local ok, err = token_store:set(token_username, token_id, {
secret_sha256 = hashes.sha256(token_secret, true);
token_info = token_info
});
+ if not ok then
+ return nil, err;
+ end
return token, token_info;
end