authly-me 0.0.4 → 0.0.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/index.js +19 -1
  2. package/package.json +1 -1
package/index.js CHANGED
@@ -59,7 +59,25 @@ class Authly {
59
59
 
60
60
  // TODO : Get credits used ( app level )
61
61
 
62
- // TODO : Logout ( given the token )
62
+ // Logout Session
63
+ async logout(token) {
64
+ if (!token || token === '' || token.trim() === '') {
65
+ throw new Error('Token is required');
66
+ }
67
+
68
+ const payload = {
69
+ key: this.key,
70
+ token: token
71
+ };
72
+
73
+ let response;
74
+ try {
75
+ response = await axios.post(`${this.server_url}/v1/auth/app/logout-session`, payload);
76
+ return response.data;
77
+ } catch (error) {
78
+ return error.response.data;
79
+ }
80
+ }
63
81
 
64
82
  }
65
83
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "authly-me",
3
- "version": "0.0.4",
3
+ "version": "0.0.5",
4
4
  "main": "index.js",
5
5
  "scripts": {
6
6
  "test": "echo \"Error: no test specified\" && exit 1"