Skip to content
This repository has been archived by the owner on Jan 5, 2024. It is now read-only.

Commit

Permalink
Apple and FB social sign in (#1077)
Browse files Browse the repository at this point in the history
* Adds Apple and FB as socials options
  • Loading branch information
iketw authored Nov 16, 2023
1 parent bd60e5a commit 8ab2eaa
Show file tree
Hide file tree
Showing 12 changed files with 37 additions and 28 deletions.
2 changes: 1 addition & 1 deletion docs/onboarding/0 Getting Started/API Keys.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ API Keys allow you to:
- Upload and download assets to IPFS using Storage via dashboard, CLI, or SDKs
- Use a dedicated RPC Edge service in your application
- Use Bundler & Paymaster services for your Smart Wallets
- Enable various services such as signing in with Google, Email, and Custom JWT when using Embedded wallets.
- Enable various services such as signing in with Google, Facebook, Apple, Email, and Custom JWT when using Embedded wallets.

API Keys consists of two components:

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -488,7 +488,7 @@ A function that returns a React component that renders the UI for selecting your

Instead of the default icon + name in wallet selector screen, you can render a custom UI for your wallet.

Take [Embedded wallet](https://github.com/thirdweb-dev/js/blob/main/packages/react/src/wallet/wallets/embeddedWallet/embeddedWallet.tsx) for example, It renders an Sign in with Google + Email Input.
Take [Embedded wallet](https://github.com/thirdweb-dev/js/blob/main/packages/react/src/wallet/wallets/embeddedWallet/embeddedWallet.tsx) for example, It renders an Social Icons + Email Input.

:::info

Expand Down Expand Up @@ -717,7 +717,7 @@ function MyWalletConnectionUI(props: ConnectUIProps<MyWallet>) {

Instead of the default icon + name in the wallet selector screen, you can render a custom UI for your wallet.

Take [Embedded wallet](https://github.com/thirdweb-dev/js/blob/main/packages/react/src/wallet/wallets/embeddedWallet/embeddedWallet.tsx) for example, It renders an Sign in with Google + Email Input.
Take [Embedded wallet](https://github.com/thirdweb-dev/js/blob/main/packages/react/src/wallet/wallets/embeddedWallet/embeddedWallet.tsx) for example, It renders Social Icons + Email Input.

<img src="/assets/connect-wallet/connect-wallet-embedded-compact.png" />

Expand Down
7 changes: 4 additions & 3 deletions docs/onboarding/12 Wallet/4 Wallets/Embedded Wallet.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -96,9 +96,10 @@ type EmailVerificationAuthParams = {
recoveryCode?: string;
};

// google sign-in
type GoogleAuthParams = {
strategy: "google";
export type EmbeddedWalletOauthStrategy = "google" | "apple" | "facebook";

type OauthAuthParams = {
strategy: EmbeddedWalletOauthStrategy;
openedWindow?: Window;
closeOpenedWindow?: (window: Window) => void;
};
Expand Down
2 changes: 1 addition & 1 deletion docs/onboarding/21 Embedded Wallet/2 Getting Started.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ const wallet = new EmbeddedWallet({
});

const authResult = await wallet.authenticate({
strategy: "google", // The authentication strategy to use
strategy: "google", // The authentication strategy to use, can be any of the supported strategies (google, facebook, apple, email, jwt)
});
const walletAddress = await wallet.connect({ authResult });
```
Expand Down
8 changes: 4 additions & 4 deletions docs/onboarding/21 Embedded Wallet/3 How To/0 Connect.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ export default function App() {

### Choose authentication methods

By default, the connect UI supports Google and email/password authentication. You can customize which authentication methods to support which will be reflected in the UI.
By default, the connect UI supports Google, Apple, Facebook and email/password authentication. You can customize which authentication methods to support which will be reflected in the UI.

<Tabs>
<TabItem value="react" label="React">
Expand All @@ -91,7 +91,7 @@ By default, the connect UI supports Google and email/password authentication. Yo
supportedWallets={[
embeddedWallet({
auth: {
options: ["google", "email"],
options: ["email", "facebook", "apple", "google"],
}
})
]}
Expand All @@ -107,8 +107,8 @@ By default, the connect UI supports Google and email/password authentication. Yo
supportedWallets={[
embeddedWallet({
auth: {
options: ["google", "email"],
redirectUrl: "your_app://deeplink" // required for google auth
options: ["email", "facebook", "apple", "google"],
redirectUrl: "your_app://deeplink" // required for social logins only
}
})
]}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,8 @@ import { ThirdwebProvider, embeddedWallet() } from "@thirdweb-dev/react"; // or

## Authenticate via Google

Note that for Apple and Facebook you just need to update the strategey to "facebook" or "apple".

<Tabs>
<TabItem value="react" label="React & React Native">

Expand Down
2 changes: 1 addition & 1 deletion docs/onboarding/21 Embedded Wallet/5 FAQ.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ Users can access it by choosing the thirdweb option in WalletConnect. They will

### What login options does thirdweb support?

We support Google and email out of the box, and embedded wallets can be configured to work with any Open ID Compatible authentication service. We will be adding out of the box support for more social login options soon.
We support Google, Apple, Facebook and email out of the box, and embedded wallets can be configured to work with any Open ID Compatible authentication service. We will be adding out of the box support for more social login options soon.

# Customization FAQs

Expand Down
10 changes: 6 additions & 4 deletions docs/react-native/wallets/EmbeddedWallet.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import TabItem from "@theme/TabItem";
import CodeBlock from "@theme/CodeBlock";
import { CustomizeWalletConfiguratorRN } from "@components/build-wallet/CustomizeWalletConfiguratorRN";

A wallet configurator for [Embedded Wallet](/wallet/embedded-wallet) (email + Google Sign In) which allows integrating the wallet with React Native.
A wallet configurator for [Embedded Wallet](/wallet/embedded-wallet) (email or Socials Sign In) which allows integrating the wallet with React Native.

```tsx
import { embeddedWallet } from "@thirdweb-dev/react-native";
Expand Down Expand Up @@ -43,7 +43,7 @@ We wrote [a short guide](/react-native/faq/deeplinks) to help you enable deep li
embeddedWallet({
// highlight-start
auth: {
options: ["email", "google", "apple"],
options: ["email", "google", "apple", "facebook"],
redirectUrl: "deep-link-to-your-app://",
},
// highlight-end
Expand Down Expand Up @@ -141,7 +141,7 @@ Here are the dependencies added:
- react-native-aes-gcm-crypto
- This package requires minSdkVersion = 26 on Android
- @react-native-community/netinfo
- react-native-inappbrowser-reborn: "^3.7.0" (for Google Sign In)
- react-native-inappbrowser-reborn: "^3.7.0" (for Socials Sign In)

- There's an open issue on RN > 0.72: https://github.com/margelo/react-native-quick-crypto/issues/186 which you can [fix by](https://github.com/margelo/react-native-quick-crypto/issues/186#issuecomment-1663666739) adding the following to your `android/app/build.gradle` file:

Expand Down Expand Up @@ -181,6 +181,8 @@ The hook will return all the necessary functions you'll need to authenticate and

**Connecting with Google sign in:**

Note that if you want to sign in with Facebook or Apple you'll need pass "apple" or "facebook" to the `strategy` parameter.

```tsx
function App() {
const { connect } = useEmbeddedWallet();
Expand Down Expand Up @@ -232,7 +234,7 @@ type EmailVerificationAuthParams = {
};

type SocialAuthParams = {
strategy: "google" | "apple";
strategy: "google" | "apple" | "facebook";
redirectUrl: string;
};

Expand Down
7 changes: 4 additions & 3 deletions docs/react/hooks/wallet/useEmbeddedWallet.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -72,9 +72,10 @@ type EmailVerificationAuthParams = {
recoveryCode?: string;
};

// google sign-in
type GoogleAuthParams = {
strategy: "google";
export type EmbeddedWalletOauthStrategy = "google" | "apple" | "facebook";

type OauthAuthParams = {
strategy: EmbeddedWalletOauthStrategy;
openedWindow?: Window;
closeOpenedWindow?: (window: Window) => void;
};
Expand Down
13 changes: 8 additions & 5 deletions docs/react/wallets/embeddedWallet.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -31,13 +31,13 @@ const embeddedWalletConfig = embeddedWallet();

Customize what authentication options to show to your users in the [ConnectWallet Modal](/react/react.connectwallet).

By default, email and Google sign in options are shown.
By default, email, Google, Apple and Facebook sign in options are shown.

```ts
embeddedWallet({
// highlight-start
auth: {
options: ["email", "google"],
options: ["email", "google", "apple", "facebook"],
},
// highlight-end
});
Expand Down Expand Up @@ -86,6 +86,8 @@ The hook will return all the necessary functions you'll need to authenticate and

**Connecting with Google sign in:**

Note that if you want to sign in with Apple or Facebook, you can pass in `strategy: "apple"` or `strategy: "facebook"` instead.

```tsx
function App() {
const { connect } = useEmbeddedWallet();
Expand Down Expand Up @@ -151,9 +153,10 @@ type EmailVerificationAuthParams = {
recoveryCode?: string;
};

// google sign-in
type GoogleAuthParams = {
strategy: "google";
export type EmbeddedWalletOauthStrategy = "google" | "apple" | "facebook";

type OauthAuthParams = {
strategy: EmbeddedWalletOauthStrategy;
openedWindow?: Window;
closeOpenedWindow?: (window: Window) => void;
};
Expand Down
6 changes: 3 additions & 3 deletions docs/unity/connecting-to-wallets/EmbeddedWallet.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -81,23 +81,23 @@ string address = await sdk.wallet.Connect(connection);

If using Email OTP flow, displays a modal where you can input your OTP code.

If using Google OAuth2 flow, opens a popup where you can login with your Google account. If successful, the popup will close and the wallet will connect.
If using OAuth2 flow, opens a popup where you can login with your provider account. If successful, the popup will close and the wallet will connect.

If using Custom JWT flow, attempts to connect directly after verifying the JWT token.

### Standalone

If using Email OTP flow, displays a modal where you can input your OTP code.

If using Google OAuth2 flow, opens the default browser where you can login with your Google account. Connects after the login flow is complete.
If using the OAuth2 flow, opens the default browser where you can login with your provider account. Connects after the login flow is complete.

If using Custom JWT flow, attempts to connect directly after verifying the JWT token.

### Mobile

If using Email OTP flow, displays a modal where you can input your OTP code.

If using Google OAuth2 flow, interacts with native in-app browser/authentication implementations to login with your Google account. Redirects back to the app through a deep link after the login flow is complete. Only available in builds.
If using the OAuth2 flow, interacts with native in-app browser/authentication implementations to login with your provider account. Redirects back to the app through a deep link after the login flow is complete. Only available in builds.

If using Custom JWT flow, attempts to connect directly after verifying the JWT token.

Expand Down
2 changes: 1 addition & 1 deletion submodules/contracts
Submodule contracts updated 36 files
+3 −10 contracts/prebuilts/account/dynamic/DynamicAccount.sol
+7 −19 contracts/prebuilts/account/dynamic/DynamicAccountFactory.sol
+10 −2 contracts/prebuilts/account/interface/IAccountFactory.sol
+3 −3 contracts/prebuilts/account/managed/ManagedAccount.sol
+5 −20 contracts/prebuilts/account/managed/ManagedAccountFactory.sol
+5 −29 contracts/prebuilts/account/non-upgradeable/Account.sol
+6 −11 contracts/prebuilts/account/non-upgradeable/AccountFactory.sol
+23 −26 contracts/prebuilts/account/utils/AccountCore.sol
+1 −2 contracts/prebuilts/account/utils/AccountCoreStorage.sol
+3 −27 contracts/prebuilts/account/utils/AccountExtension.sol
+33 −46 contracts/prebuilts/account/utils/BaseAccountFactory.sol
+0 −23 contracts/prebuilts/account/utils/BaseAccountFactoryStorage.sol
+1 −1 contracts/prebuilts/marketplace/marketplace-v3.md
+2 −13 src/test/benchmark/AccountBenchmark.t.sol
+0 −297 src/test/marketplace/english-auctions/_payout/_payout.t.sol
+0 −17 src/test/marketplace/english-auctions/_payout/_payout.tree
+0 −202 src/test/marketplace/english-auctions/_transferAuctionTokens/_transferAuctionTokens.t.sol
+0 −9 src/test/marketplace/english-auctions/_transferAuctionTokens/_transferAuctionTokens.tree
+0 −304 src/test/marketplace/english-auctions/_validateNewAuction/_validateNewAuction.t.sol
+0 −20 src/test/marketplace/english-auctions/_validateNewAuction/_validateNewAuction.tree
+0 −683 src/test/marketplace/english-auctions/bidInAuction/bidInAuction.t.sol
+0 −52 src/test/marketplace/english-auctions/bidInAuction/bidInAuction.tree
+0 −261 src/test/marketplace/english-auctions/cancelAuction/cancelAuction.t.sol
+0 −14 src/test/marketplace/english-auctions/cancelAuction/cancelAuction.tree
+0 −298 src/test/marketplace/english-auctions/collectAuctionPayout/collectAuctionPayout.t.sol
+0 −17 src/test/marketplace/english-auctions/collectAuctionPayout/collectAuctionPayout.tree
+0 −298 src/test/marketplace/english-auctions/collectAuctionTokens/collectAuctionTokens.t.sol
+0 −18 src/test/marketplace/english-auctions/collectAuctionTokens/collectAuctionTokens.tree
+0 −318 src/test/marketplace/english-auctions/createAuction/createAuction.t.sol
+0 −13 src/test/marketplace/english-auctions/createAuction/createAuction.tree
+4 −193 src/test/smart-wallet/Account.t.sol
+6 −44 src/test/smart-wallet/AccountVulnPOC.t.sol
+10 −152 src/test/smart-wallet/DynamicAccount.t.sol
+8 −149 src/test/smart-wallet/ManagedAccount.t.sol
+2 −13 src/test/smart-wallet/account-core/isValidSigner.t.sol
+4 −16 src/test/smart-wallet/account-permissions/setPermissionsForSigner.t.sol

1 comment on commit 8ab2eaa

@vercel
Copy link

@vercel vercel bot commented on 8ab2eaa Nov 16, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.