New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@magic-sdk/sso

Package Overview
Dependencies
Maintainers
8
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@magic-sdk/sso

Magic Javascript SSO SDK

  • 0.2.1
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
0
Maintainers
8
Weekly downloads
 
Created
Source

Magic SSO Admin Javascript SDK

Magic SSO Admin SDK provides an easy interface for integrating parties to implement SAML/SSO authentication offered by the Magic platform to select vendors.

Installation

This is an experimental SSO implementation using magic intended only for select partners.

npm install --save @magic-sdk/sso

or

yarn add @magic-sdk/sso

Usage

Generating a SAML Project and configuring a provider

const MagicSSO = require('@magic-sdk/sso');

// Create a Magic Admin SSO instance
const magicSSO = new MagicSSO(‘YOUR_DEVELOPER_SECRET_KEY’);

// Login Users
const SAMLConnectionInfo = await magicSSO.addSamlConnection();

await magicSSO.setProvider({
  project_id, /* from addSamlConnection */
  entity_id, /* from IDP */
  redirect_url,
  issuer, /* IDP Name ie. auth0 */
  sso_url, /* from IDP */
  signing_certificate, /* from IDP */
  metadata_url,
  options,
 });

Logging in a SAML user

import express from 'express';
const MagicSSO = require('@magic-sdk/sso');

const app = express();

// Create a Magic Admin SSO instance
const magicSSO = new MagicSSO(‘YOUR_DEVELOPER_SECRET_KEY’);

// Logging Users In

// Authentication endpoint
app.get('/auth', async (req: any, res: any) => {
  try {
    const { projectID } = req.query;
    const authorizationURL = await magicSSO.getAuthorizationUrl(projectID);
    res.redirect(authorizationURL);
  } catch (err) {
    console.error(err);
  }
});

// Callback endpoint
app.get('/callback', async (req: any, res: any) => {
  try {
    const { code } = req.query;
    const userInfo = await magicSSO.getProfile(code);
    // ... logged in
    res.redirect('/');
  } catch (err) {
    console.error(err);
  }
});

Refer to src/node-e2e/app.ts for reference implementation

FAQs

Package last updated on 11 Feb 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