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.
{"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"
}
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.
@hiveio/hivejs were merged 5 months agoconst 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.
Anyway, I'll keep up the good work on Hive. Thank you for checking my post.