3Speak Mobile App / dApps can integrate new Acela-Core to login

in LeoFinance10 months ago

Hello 3Speak & Hive Community members,

With this post, I'll talk about new APIs which mobile app will be using.
I'll also explain how to use those API which can be used on any dApps.
And I'll also share all the links to those resources so that you can study & try it out on your own.

Link to documentation

Screenshot 2024-01-30 at 8.39.29 AM.png

  • Here you can find the link to documentation - https://staging.3speak.tv/api/v1/docs
  • As shown in the screenshot above, you can find all APIs details.
  • Documentation covers every API request structure & response structure.
  • At the end, you'll also find schemas with which you can get an understanding on necessary objects.

Acela-Core

  • Acela-Core is a new Backend core for decentralised video applications on HIVE.
  • It also supports logging in with social-accounts like twitter, github, gmail etc.
  • In this post, I'll explain about how to login with Hive account.
  • Other types of logins which are supported, I'll share more details as and when I get more familiar with.
  • Acela-core repository can be found here - https://github.com/spknetwork/acela-core

Acela-Core - login with hive account

  • Step 1. Create a payload which has account name & timestamp. Payload should look as follows.
{"account":"sagarkothari88","ts":"2024-01-29T16:15:24.515Z"}
  • Step 2. Get this payload signed with posting key. Now, in order to sign, either you can use posting key of user in case if you've access to it. In case of login via keychain, you can ask keychain to sign the payload for you.

  • Step 3. Once you've the proof of signed payload, you can compose a JSON object as follows.

{
  "username": "sagarkothari88",
  "network": "hive",
  "authority_type": "posting",
  "proof_payload": "{\"account\":\"sagarkothari88\",\"ts\":\"2024-01-29T16:15:24.515Z\"}",
  "proof": "201134af9d7a90b858abcdefg52b6d6f9401532132484cef83f50fb633efd2e0e90240aa56c68bd1deba1eb4a510a261c94827f07d23497ac148aa0b1bedd919ea"
}
  • Step 4. Send a post request to acela-core backend with above json object. Here is the cURL of the request.
curl 'https://acela.us-02.infra.3speak.tv/api/v1/auth/login_singleton' \
  -H 'Accept: application/json, text/plain, */*' \
  -H 'Content-Type: application/json' \
  --data-raw '{"username":"sagarkothari88","network":"hive","authority_type":"posting","proof_payload":"{\"account\":\"sagarkothari88\",\"ts\":\"2024-01-29T16:15:24.515Z\"}","proof":"201134af9d7a90b858abcdefg52b6d6f9401532132484cef83f50fb633efd2e0e90240aa56c68bd1deba1eb4a510a261c94827f07d23497ac148aa0b1bedd919ea"}' \
  --compressed

Here is the example response which you'll get.

{
  "access_token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiaWF0IjoxNTE2MjM5MDIyfQ.SflKxwRJSMeKKF2QT4fwpMeJf36POk6yJV_adQssw5c"
}

Congratulations. You're logged in. Now, you can use this JWT token for further requests.

Get proof via Keychain

Screenshot 2024-01-30 at 9.45.19 AM.png

Get proof via posting key

Screenshot 2024-01-30 at 9.48.33 AM.png

  • Signing is simple with hivejs
const proof = hive.auth.signMessage(message, privateKey)

I wish you all the luck for integrating sign-in-with-hive-account using acela-core.
Let me know in the comment section if you find any difficulties.

that's all

Anyway, I'll keep up the good work on Hive. Thank you for checking my post.

Who am I?

  • I'm a hive witness
  • 3Speak App Developer
  • Founder of HiveCurators Community - @hive-185924
  • I also contributed to mobile-app for HiveAuth

Support me

  • Please upvote my content to motivate me.
  • Do you like the work I do?
  • Do you want me to keep going?
  • Please Reblog
  • Please help me connect with more communities
  • Please vote me as Hive Witness

Vote me as Hive Witness

Support @sagarkothari88

Posted Using InLeo Alpha

Sort:  

This post has been manually curated by @bhattg from Indiaunited community. Join us on our Discord Server.

Do you know that you can earn a passive income by delegating to @indiaunited. We share more than 100 % of the curation rewards with the delegators in the form of IUC tokens. HP delegators and IUC token holders also get upto 20% additional vote weight.

Here are some handy links for delegations: 100HP, 250HP, 500HP, 1000HP.

image.png

100% of the rewards from this comment goes to the curator for their manual curation efforts. Please encourage the curator @bhattg by upvoting this comment and support the community by voting the posts made by @indiaunited.

Thank you @bhattg & @indiaunited

you are welcome sir ji

!LOLZ

Why did the coffee go to the police?
Because it was mugged.

Credit: reddit
@sagarkothari88, I sent you an $LOLZ on behalf of memess

(8/10)
Delegate Hive Tokens to Farm $LOLZ and earn 110% Rewards. Learn more.

Thank you for this detailed step by step guide to access Acela-Core. Great work @sagarkothari88 ji!

!LUV

sagarkothari88, splash-of-angs63 sent you LUV. 🙂 (2/5) tools | trade | connect | daily

Made with LUV by crrdlx.

Acela-Core's dual role as a Hive backend and a dApp builder platform is groundbreaking. It unlocks the potential for creating next-generation video applications that seamlessly integrate with the Hive ecosystem. That's lovely keep up the good work.

Thank you. I'll keep sharing more details as I implement those in the app.

You are welcome.. I can't wait to see more when you shared them..


You've been curated by @plantpoweronhive! Delegations welcome!

Find our community here | Curation Trail