npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

arthera-login-react-sdk

v1.0.1

Published

Readme

ArtheraLoginSDK API Reference

Table of Contents

Introduction

The [ArtheraLoginSDK] class provides methods for handling user authentication and login using various social login providers such as Microsoft, GitHub, Twitter, and Google. It also manages the user's wallet address and provider information.

Installation

To use the [ArtheraLoginSDK] in your project, you need to install the necessary dependencies:

npm install axios qs crypto-js @ethersproject/providers @ethersproject/transactions

Configuration

The config.js file contains the configuration for the social login providers. Make sure to set the appropriate environment variables for each provider:

config.js

Usage

Installation:

To install the [reactjs-social-login] library, you can use the following npm command:

npm install reactjs-social-login

Here's an example of how to use the ArtheraLoginSDK in your React components:

LoginPage.js

AuthPage.js

API Methods

constructor()

Initializes a new instance of the ArtheraLoginSDK class.

isLoggedIn()

Checks if the user is currently logged in.

Returns:

  • boolean: true if the user is logged in, false otherwise.

loginWithMicrosoft(token, id)

Logs in the user using Microsoft authentication.

Parameters:

  • token (string): The Microsoft access token.

  • id (string): The user's Microsoft ID.

loginWithGithub(code, user)

Logs in the user using GitHub authentication. Parameters:

  • code (string): The GitHub authorization code.
  • user (object): The GitHub user object.

loginWithTwitter(token, user)

Logs in the user using Twitter authentication.

Parameters:

  • token (string): The Twitter access token.
  • user (object): The Twitter user object.

loginWithGoogle(token, sub)

Logs in the user using Google authentication.

Parameters:

  • token (string): The Google access token.
  • sub (string): The user's Google sub (unique identifier).

getAddress()

Retrieves the user's wallet address.

Returns:

  • Promise<string>: A promise that resolves to the user's wallet address.

getProvider()

Retrieves the user's provider.

Returns:

  • JsonRpcProvider: The user's provider.

logout()

Logs out the user and clears the session data.

handleLogin()

Handles the login process based on the provided authorization code and state.

generateCodeVerifierAndChallenge()

Generates a code verifier and code challenge for the OAuth2 authorization code flow.

Returns:

  • object: An object containing the codeVerifier and codeChallenge.

fetchGoogleUserInfo(accessToken)

Fetches the user's Google profile information using the provided access token.

Parameters:

  • accessToken (string): The Google access token.

Returns:

  • Promise<object>: A promise that resolves to the user's Google profile information.

LoginSocialTwitter Component

The LoginSocialTwitter component is a reusable component that handles the Twitter login process. It opens a popup window for the user to authenticate with Twitter and retrieves the authorization code.

Props

  • client_id (string, required): The Twitter client ID.
  • className (string, optional): Additional CSS class name for the component. Default is an empty string.
  • redirect_uri (string, required): The redirect URI for the Twitter authentication.
  • children (node, optional): The child elements to be rendered inside the component.
  • fields (string, optional): The fields to be included in the Twitter user object. Default is 'created_at,description,entities,id,location,name,pinned_tweet_id,profile_image_url,protected,public_metrics,url,username,verified,withheld'.
  • state (string, optional): The state parameter for the Twitter authentication. Default is 'state'.
  • scope (string, optional): The scope parameter for the Twitter authentication. Default is 'users.read%20tweet.read'.
  • isOnlyGetCode (boolean, optional): Flag to indicate if only the authorization code should be retrieved. Default is false.
  • isOnlyGetToken (boolean, optional): Flag to indicate if only the access token should be retrieved. Default is false.
  • onLoginStart (function, optional): Callback function to be called when the login process starts.
  • onReject (function, optional): Callback function to be called when the login process is rejected.
  • onResolve (function, optional): Callback function to be called when the login process is resolved.
  • code_challenge (string, optional): The code challenge for the OAuth2 authorization code flow. Default is 'challenge'.
  • code_challenge_method (string, optional): The code challenge method for the OAuth2 authorization code flow. Default is 'plain'.

Usage

In this example, the LoginSocialTwitter component is used with the required client_id and redirect_uri props. The onLoginStart, onReject, and onResolve callbacks are provided to handle the different stages of the login process. The child element <button>Login with Twitter</button> is rendered inside the component.

These are the main methods provided by the ArtheraLoginSDK class. You can use these methods to handle user authentication, retrieve user information, and manage the login process in your React application.

For more detailed usage examples, refer to the LoginPage.js, AuthPage.js, and LoginSocialTwitter.js components provided in the code snippets.