Skip to content

Commit

Permalink
Merge pull request #13 from magiclabs/feat/use-email-otp
Browse files Browse the repository at this point in the history
Update dedicated connector to use Email OTP
  • Loading branch information
joshuascan committed Dec 21, 2023
2 parents 9dbe138 + 43497ad commit f24a784
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 11 deletions.
18 changes: 9 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

[WAGMI](https://wagmi.sh/) Connector to connect with [Magic](https://magic.link/). Magic is a developer SDK that you can integrate into your application to enable passwordless authentication using magic links, OTPs, OAuth from third-party services, and more for your web3 App.

Special thanks for the [Everipedia](https://github.com/EveripediaNetwork) team for creating the connector and working with us for ongoing support and maintenance.
Special thanks to the [Everipedia](https://github.com/EveripediaNetwork) team for creating the connector and working with us for ongoing support and maintenance.

![Frame 184 (4)](https://user-images.githubusercontent.com/52039218/174133833-fc63f237-63bf-4134-a22b-ce77ae0f2a9b.png)

Expand Down Expand Up @@ -60,15 +60,15 @@ import { DedicatedWalletConnector, UniversalWalletConnector } from '@magiclabs/w
// Dedicated Wallet integration
const connector = new DedicatedWalletConnector({
options: {
apiKey: YOUR_MAGIC_LINK_API_KEY, //required
apiKey: YOUR_MAGIC_PUBLISHABLE_API_KEY, //required
//...Other options
},
});

// Universal Wallet integration
const connector = new UniversalWalletConnector({
options: {
apiKey: YOUR_MAGIC_LINK_API_KEY, //required
apiKey: YOUR_MAGIC_PUBLISHABLE_API_KEY, //required
//...Other options
},
});
Expand Down Expand Up @@ -140,7 +140,7 @@ You configure OAuth with magic by adding the following options to the connector:
```javascript
const connector = new DedicatedWalletConnector({
options: {
apiKey: YOUR_MAGIC_LINK_API_KEY, //required
apiKey: YOUR_MAGIC_PUBLISHABLE_API_KEY, //required
oauthOptions : {
providers: ['facebook', 'google', 'twitter'],
callbackUrl: 'https://your-callback-url.com', //optional
Expand All @@ -157,23 +157,23 @@ You can enable SMS authentication by adding the following options to the connect
```javascript
const connector = new DedicatedWalletConnector({
options: {
apiKey: YOUR_MAGIC_LINK_API_KEY, //required
apiKey: YOUR_MAGIC_PUBLISHABLE_API_KEY, //required
enableSMSLogin: true, //optional (default: false)
//...Other options
},
});
```

You have to enable SMS authentication in your Magic Link account first to make it work.
You have to enable SMS authentication in your [Magic dashboard](https://dashboard.magic.link) first to make it work.

## 📧 Disable Email Authentication

By default Email Authentication is set to true as default. if you wish to remove sending magic links via emails, pass ```enableEmailLogin: false``` in options object as follows :
By default Email is set to true as default. if you wish to remove Email OTP, pass `enableEmailLogin: false` in options object as follows :

```javascript
const connector = new DedicatedWalletConnector({
options: {
apiKey: YOUR_MAGIC_LINK_API_KEY, //required
apiKey: YOUR_MAGIC_PUBLISHABLE_API_KEY, //required
enableEmailLogin: false, //optional (default: true)
//...Other options
},
Expand All @@ -190,7 +190,7 @@ import { DedicatedWalletConnector } from '@magiclabs/wagmi-connector';

const connector = new DedicatedWalletConnector({
options: {
apiKey: YOUR_MAGIC_LINK_API_KEY,
apiKey: YOUR_MAGIC_PUBLISHABLE_API_KEY,
accentColor: '#ff0000',
customLogo: 'https://example.com/logo.png',
headerText: 'Login to your account',
Expand Down
2 changes: 1 addition & 1 deletion src/lib/connectors/dedicatedWalletConnector.ts
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ export class DedicatedWalletConnector extends MagicConnector {

// LOGIN WITH MAGIC USING EMAIL
if (modalOutput.email)
await magic.auth.loginWithMagicLink({
await magic.auth.loginWithEmailOTP({
email: modalOutput.email,
})

Expand Down
2 changes: 1 addition & 1 deletion src/lib/modal/view.ts
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ export const createModal = async (props: {
${
props.enableSMSLogin || props.enableEmailLogin
? ` <button class="Magic__submitButton" type="submit">
Send login link
Log in / Sign up
</button>`
: ''
}
Expand Down

0 comments on commit f24a784

Please sign in to comment.