Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More โ†’
Socket
Sign inDemoInstall
Socket

@magic-ext/oauth2

Package Overview
Dependencies
Maintainers
0
Versions
356
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@magic-ext/oauth2

Magic SDK OAuth Extension for Web environments.

  • 9.17.0-canary.828.11782136981.0
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
1.7K
decreased by-4.5%
Maintainers
0
Weekly downloads
ย 
Created
Source

๐Ÿ”’ Magic OAuth Extension for Web Browsers

<MagicLabs>

With the Magic JavaScript SDK OAuth 2 extension, you can plug into your favorite social login providers with one, easy-to-use API.

License ยท Changelog ยท Contributing Guide

๐Ÿ“– Documentation

See the developer documentation to learn how to get started with OAuth in Magic SDK.

๐Ÿ”— Installation

Integrating your app with OAuth will require our client-side NPM package and OAuth 2 extension:

# Via NPM:
npm install --save magic-sdk @magic-ext/oauth2

# Via Yarn:
yarn add magic-sdk @magic-ext/oauth2

Alternatively, you can load via CDN with by adding a script tag to your appโ€™s <head>:

<script src="https://cdn.jsdelivr.net/npm/magic-sdk/dist/magic.js"></script>
<script src="https://cdn.jsdelivr.net/npm/@magic-ext/oauth2/dist/extension.js"></script>

โšก๏ธ Quick Start

Sign up or log in to the developer dashboard to receive API keys that will allow your application to interact with Magic's authentication APIs.

Then, you can start authenticating users with just two method calls!

From your login page:

import { Magic } from 'magic-sdk';
import { OAuthExtension } from '@magic-ext/oauth2';

const magic = new Magic('YOUR_API_KEY', {
  extensions: [new OAuthExtension()]
});

await magic.oauth2.loginWithRedirect({
  provider: 'google' | 'facebook' | 'github' | ...
});

From your OAuth callback page:

import { Magic } from 'magic-sdk';
import { OAuthExtension } from '@magic-ext/oauth2';

const magic = new Magic('YOUR_API_KEY', {
  extensions: [new OAuthExtension()],
});

const res = await magic.oauth2.getRedirectResult();

// Then you can access a user's Magic DID token, OpenID Connect profile information, and more!
res.magic.idToken;
res.oauth.userInfo;

FAQs

Package last updated on 11 Nov 2024

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