Development Progress on Decentralized Login Auth - SteemWatcher New Update.

in Steem Devlast month (edited)

Most featured posts & Plagiarism report_20240529_163755_0000.png

Hello everyone!

We are excited to share a significant development regarding the login system of Steemwatcher Portal. As you all now, we are shifting our login authentication system of steemwatcher portal from centralized system to decentralized system. we are working to integrate the login authentication of steemwatcher with steemconnect AUTH using Steem JS lib.

From the last week, we have been diligently working to use the power of steemit blockchain technology for our steemwatcher portal.

Previously, Steemwatcher relied on a centralized login system where users were required to create an account directly on our platform. Now we have successfully achieved and integrate the our login system with steemconnect but there are many new things that we will move one by one and integrate with steemit.

I am actively exploring solutions to address the remaining challenges and ensure that all aspects of the platform align with the principles of decentralization. because in the previous system, we are maintaining the login session on the base of user account at the time of login from out database but now user will directly login with steemit posting key and will eligible for abuse reporting.

Our next development will on role level security system. It will divided into three parts, one is Admin role, second is detective role and third is general user.

function loginSteemit() {
const username = document.getElementById('userName').value;
const privatePostingKey = document.getElementById('password').value;

steem.api.setOptions({ url: 'https://api.steemit.com' });

steem.api.getAccounts([username], (err, result) => {
     if (err) {
        console.error(err);
        showMessage('Error occurred!', 'Failed');
        return;
                }
     if (result.length === 0) {
        showMessage('Username is not correct!', 
        'Failed');
         return;
                }

const publicPostingKey = result[0].posting.key_auths[0][0];
  const loginSuccess = steem.auth.wifIsValid(privatePostingKey, publicPostingKey);

    if (loginSuccess) {
        showMessage('Logged in successfully!', 'Success');
                    const xhr = new XMLHttpRequest();
                    xhr.open('POST', 'set_session.php', true);
                    xhr.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
                    xhr.onreadystatechange = function() {
                        if (xhr.readyState === 4 && xhr.status === 200) {
                            const response = JSON.parse(xhr.responseText);
                            if (response.status === 'success') {
                                window.location.assign(response.url);
                            } else {
                                showMessage(response.message, 'Failed');
                            }
                        }
                    };
                    xhr.send('username=' + encodeURIComponent(username));
                } else {
                    showMessage('You are not an authorized user', 'Failed');
                }
            });
        }

The above is the Steemconnect JavaScript code. In the above code i am using the ajax that will help to integrate the JavaScript code to the PHP script file. It will help to handle user authentication. After successful authentication, system will set session for the logged-in user. After successful login. the PHP script should check if the logged-in user is a detective by querying the detective table in our database. If the user is a detective then it will set a session variable indicating their detective role.

We look forward to your feedback and are excited to bring you more updates soon!



Please cast witness vote to bangla.Witness or set proxy to rme.

_
Vote bangla.witness as witness
Set Proxy rme as proxy

Special Thanks.

Cc: @rme
Cc: @hungry-griffin
Cc: @steemcurator01
Cc: @steemchiller
Cc: @pennsif

Thanks for giving your precious time to my post.
Follow | Upvote | Share | Comments
Follow me on Instagram.
Instagram

🆃🅷🅰️🅽🅺 🆈🅾️🆄

Sort:  

Upvoted! Thank you for supporting witness @jswit.

This post has been featured in the latest edition of Steem News...

Coin Marketplace

STEEM 0.20
TRX 0.13
JST 0.030
BTC 61521.43
ETH 3387.82
USDT 1.00
SBD 2.49