[![](https://ipfs-3speak.b-cdn.net/ipfs/bafkreici4xftewp5udqd6yb6vquugxuthy2mhezkbgbgocytmcj6xbdw6y/)](https://3speak.tv/watch?v=sagarkothari88/uvjvqavy) ▶️ [Watch on 3Speak](https://3speak.tv/watch?v=sagarkothari88/uvjvqavy) --- Hello Community Members, This is an unofficial update from @sagarkothari88 about 3Speak. Official updates will be provided by @threespeak 's handle. ![thumbnail](https://files.peakd.com/file/peakd-hive/threespeak/23uQNvHfQ5FuxvKKHS3bqh2rCLyjC8vqXyJ7CaoFtr6edMgSo68RaCWzpNbzkRdjUeRKC.png) ## Supporting PostingKey based user sessions - Following APIs can be used by any DApp - With these APIs, DApp can - log in a user with 3Speak Platform - Show uploaded videos of a user - Full Source code can be found on github - https://github.com/spknetwork/legacy-studio-frontend-poc-react/blob/master/src/App.js ## Step 1 - Add Necessary dependencies ``` import React, { useState } from "react"; import axios from "axios"; import { wrapper } from "axios-cookiejar-support"; import { CookieJar } from "tough-cookie"; import hive from "@hiveio/hive-js"; axios.defaults.headers.post["Access-Control-Allow-Origin"] = "*"; const jar = new CookieJar(); const client = wrapper(axios.create({ jar })); const studioEndPoint = "https://studio.3speak.tv"; ``` ## Step 2 - Get Encoded JWT Access Token - In the following `logMe()` function, you can see that, I've just logged the decrypted access-token. ``` async function logMe() { try { let response = await client.get( `${studioEndPoint}/mobile/login?username=${username}`, { withCredentials: false, headers: { "Content-Type": "application/json", }, } ); console.log(`Response: ${JSON.stringify(response)}`); const memo = response.data.memo; console.log(`Memo - ${response.data.memo}`); let access_token = hive.memo.decode(postingKey, memo); access_token = access_token.replace("#", ""); console.log(`Decrypted ${access_token}\n\n`); } catch (err) { console.log(err); throw err; } } ``` ## Step 3 - Get All Videos ``` async function getAllVideoStatuses(access_token) { try { let response = await client.get( `${studioEndPoint}/mobile/api/my-videos`, { withCredentials: false, headers: { "Content-Type": "application/json", "Authorization": `Bearer ${access_token}` }, } ); return response.data; } catch (err) { console.log(err); throw err; } } ``` ## That's it. - Yes. It is as simple as this. - Get JWT Token, Decrypt it & use it to get videos of a user. ## What are you waiting for? - You can go ahead & implement it in your DApp ## Important Notes - 3Speak is also working on a complete re-write backend. - In future, we may have different APIs - These APIs may get deprected in near future. ## Feedback / Info - Do you want more Info? Please let me know via comment section. - Do you have feedback to share? Please use comment section ## Support Me | Please 🙏 | Support Me | |-|-| | [Donate Hive Or HBD ](https://hivelive.me/donate/sagarkothari88) | [Vote me as Hive Witness](https://hivesigner.com/sign/account-witness-vote?witness=sagarkothari88&approve=1) | ## Other Communities I recommend joining these communities on Hive & Discord.
![](https://i.imgur.com/pA7l05p.png)
[![](https://i.imgur.com/3rIRMbP.png)](https://discord.gg/bGmS2tE) *Click on the banner to join*
![](https://files.peakd.com/file/peakd-hive/pravesh0/EoASy23RK8gomWV8AuSJpQHavdnD3Lic3AzoUwwLXijDbjSV6J843o5U8Xm3ToWRGrs.png)
<a href=https://discord.gg/XZGPGpz></a>*Click on the banner to join*
![](https://i.imgur.com/pA7l05p.png)
## Important 3Speak Links | | | | | |-|-|-|-| |[3Speak.tv](https://3speak.tv)| [3Speak Twitter](https://twitter.com/3speakonline) | [3Speak Hive](https://peakd.com/@threespeak) | [3Speak Telegram](https://t.me/threespeak) | | [3Speak in Spanish](https://peakd.com/@threespeak-es/posts) | [Download Android App](https://appdistribution.firebase.dev/i/047cfb506633e639) | [Download iOS App](https://testflight.apple.com/join/0tipqwsZ) | [Download Desktop App](https://github.com/spknetwork/3Speak-app/releases) | [Join 3Speak Discord](https://discord.gg/NSFS2VGj83) | [Setup Encoder Node](https://ecency.com/hive-181335/@sagarkothari88/retfajht) | [Vote for 3Speak Proposal](https://peakd.com/hive-112019/@spknetwork/spk-network-funding-proposal-rhnv7e) | [Vote 3Speak as Witness](https://hivesigner.com/sign/account-witness-vote?witness=threespeak&approve=1) | Cheers Have a good one --- ▶️ [3Speak](https://3speak.tv/watch?v=sagarkothari88/uvjvqavy) </div> </div>