[steemconnect-firebase-functions] Version 1.3.0: downvoting, setting user metadata, and revoking access token

in utopian-io •  last year

It's time for the last of minor releases of steemconnect-firebase-functions version 1.x. In this one, I've added a few features that might be helpful - especially ability to broadcast a downvote, but please, don't use it on this post :)

Version 1.3.0

Quick Recap

steemconnect-firebase-functions is a library designed to help developers who want to create apps based on SteemConnect and Firebase. The library makes it easy to:

  • implement OAuth2 Authorization Code Grant (enables user to log in to your app using SteemConnect)
  • broadcast operations to Steem blockchain (post, comment, upvote, etc.)
  • make operations on the Firebase products (Authentication, Firestore)


New Features

Version 1.3.0 only introduces new features, so it won't break existing apps. I'm already working on version 2.0.0, which is going to be a major release and I'm super excited about this fact, because this version will bring this library to completely new level.

Anyway, here is what I did:

  • createVote function which creates and returns a vote operation
  • broadcastDownvote function
  • refactored broadcastUpvote to use createVote
  • revokeAccessToken function
  • setUserMetadata function

Let's take a deeper look at each feature:


Following the DRY principle (Don't Repeat Yourself) I've decided to add a vote operation creator function. It creates and returns a vote operation, so it can be used either by library consumer or me as I'm developing the steemconnect-firebase-functions.

It also helps to achieve my goal to publish creator functions for every operation in the version 2.0.0.

The usage of this function is really simple, for example:

import { createVote } from 'steemconnect-firebase-functions';

const voter = 'jakipatryk';
const author = 'ned';
const permlink = 'i-am-ned';
const weight = 5000; // 50%

const voteOperation = createVote(voter, author, permlink, weight);

Your can check how I implemented this feature here.


Functions should be self-descriptive. I believe this one doesn't break this rule. Now broadcasting a downvote is intuitive, I hope this feature will be useful.

Example usage:

import { broadcastDownvote } from 'steemconnect-firebase-functions';

const accessToken = 'access-token';
const voter = 'jakipatryk';
const author = 'ned';
const permlink = 'steemfest2-closing-dinner';
const weight = 10000; // 100% downvote

broadcastDownvote(accessToken, voter, author, permlink, weight).then(result => {

I used the createVote function to make this functionality working, you can check the implementation here.

broadcastUpvote refactoring

I've refactored the broadcastUpvote function to use the vote operation creator function. Of course, this change doesn't break the API.

You can check how I refactored this function here.


This feature should be used if you want to store some user-related data, but you don't want to store it neither in the blockchain or in your database.

setUserMetadata sets user metadata in the user profile on the SteemConnect. It also returns the updated user data, but in case you would need to get it later, simply use the getUserData function.

Example usage:

import { setUserMetadata } from 'steemconnect-firebase-functions';

const accessToken = '432432543njn5k43b5hj23hjbhj423.543nbrj43btjhb4';
const metadata = {
  banned: false

setUserMetadata(accessToken, metadata).then(userData => {

See how I implemented this feature here.


This feature is probably gonna be used most frequently on the user account deletion. It revokes given access token so it couldn't be used anymore.

Example usage:

import { revokeAccessToken } from 'steemconnect-firebase-functions';

const accessToken = '432432543njn5k43b5hj23hjbhj423.543nbrj43btjhb4';

revokeAccessToken(accessToken).then(result => {

See how I implemented this feature here.


That's all for now, but you can expect the version 2.0.0 in a near future, maybe even within this week.

I hope you will have fun developing apps on Firebase using this library ;)

// Note for Utopian moderators:

I couldn't add the third pull request, because I kept getting the 500 error, so the last PR for this update is available there:

Posted on Utopian.io - Rewarding Open Source Contributors

Authors get paid when people like you upvote their post.
If you enjoyed what you read here, create your account today and start earning FREE STEEM!
Sort Order:  

Thank you for the contribution. It has been approved.

You can contact us on Discord.

Hey @jakipatryk I am @utopian-io. I have just upvoted you!


  • You have less than 500 followers. Just gave you a gift to help you succeed!
  • Seems like you contribute quite often. AMAZING!

Community-Driven Witness!

I am the first and only Steem Community-Driven Witness. Participate on Discord. Lets GROW TOGETHER!


Up-vote this comment to grow my power and help Open Source contributions like this one. Want to chat? Join me on Discord https://discord.gg/Pc8HG9x