Socket
Socket
Sign inDemoInstall

@arcana/auth

Package Overview
Dependencies
Maintainers
5
Versions
109
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@arcana/auth

Arcana auth SDK for easier logins


Version published
Weekly downloads
1.1K
decreased by-6.19%
Maintainers
5
Weekly downloads
 
Created
Source

Arcana Auth

Arcana SDK to perform logins on your app.

Installation

Using NPM/Yarn

npm install --save @arcana/auth
yarn add @arcana/auth

Using built source

<script src="<path-to>/auth.js"></script>

Initialise the SDK

const { AuthProvider } = window.arcana.auth;
// or
import { AuthProvider } from '@arcana/auth';

const auth = new AuthProvider({
   appID: <appID>,
   redirectUri:'',
   oauthCreds: [{
    type: 'google',
    clientID: '',
   },
   {
    type: 'twitter',
    clientID: '',
   },
   {
    type: 'github',
    clientID: '',
   },
   {
    type: 'discord',
    clientID: '',
   }]
})

On redirect Page

const { AuthProvider } = window.arcanaAuth;

window.onload = () => {
  AuthProvider.handleRedirectPage(<origin>);
};

Initiate login

await auth.loginWithSocial(<loginType>);

Get user info

const userInfo = auth.getUserInfo();
/* 
  UserInfo: {
    loginType: 'google',
    userInfo: {
      id: 'abc@example.com',
      name: 'ABC DEF',
      email: '',
      picture: ''
    },
    privateKey: ''
  }
*/

Get public key

const userInfo = await auth.getPublicKey({
  verifier: <loginType>,
  id: <email | username>,
});

Check if user already logged in

const loggedIn = auth.isLoggedIn();
if (!loggedIn) {
  await auth.loginWithSocial(<loginType>);
}
const userInfo = auth.getUserInfo()

Clear login session

await auth.logout();

Variables

  • loginType - discord, twitter, github, google, twitch, reddit
  • origin - Base url of your app.

FAQs

Package last updated on 12 Nov 2021

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc