> ## Documentation Index
> Fetch the complete documentation index at: https://docs.dynamic.xyz/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# Distinguishing Between Login Methods

## Introduction

When a user authenticates with Dynamic, they may use various methods such as email, social login, passkey, or connecting a wallet. Understanding which method they used - and which one was used most recently - is essential for building personalized experiences and implementing proper session management.

This guide shows you how to:

1. Find the user's last used login method
2. Check all available verified credentials
3. Determine the type and provider of each credential

## Finding the Last Used Login Method

Every user has a `lastVerifiedCredentialId` property that points to the credential they most recently used to authenticate. You can use this ID to look up the credential in the `verifiedCredentials` array.

```tsx React Native theme={"system"}
import { dynamicClient } from '<path to client file>';

const checkLastLoginMethod = () => {
  const user = dynamicClient.auth.authenticatedUser;

  // Get the last verified credential ID
  const lastCredentialId = user?.lastVerifiedCredentialId;

  // Find the credential in the verifiedCredentials array
  const lastCredential = user?.verifiedCredentials?.find(
    (vc) => vc.id === lastCredentialId
  );

  if (!lastCredential) {
    console.log('No verified credentials found');
    return null;
  }

  // Check the credential type (format)
  console.log('Credential format:', lastCredential.format);
  // Possible values: 'blockchain', 'email', 'externalUser', 'oauth', 'passkey', 'phoneNumber', 'totp'

  // For wallet credentials, check the provider
  if (lastCredential.format === 'blockchain') {
    console.log('Wallet provider:', lastCredential.walletProvider);
    // Possible values: 'browserExtension', 'embeddedWallet', 'walletConnect', etc.
  }

  // For OAuth credentials, check the provider
  if (lastCredential.format === 'oauth') {
    console.log('OAuth provider:', lastCredential.oauthProvider);
  }

  return lastCredential;
};
```

## Credential Types (Format)

The `format` field on a verified credential indicates what type of authentication method was used:

| Format       | Description                                                             |
| ------------ | ----------------------------------------------------------------------- |
| `blockchain` | User authenticated by signing a message with a blockchain wallet        |
| `email`      | User authenticated via email (OTP or magic link)                        |
| `oauth`      | User authenticated via a social provider (Google, Apple, Discord, etc.) |
| `passkey`    | User authenticated using a passkey (WebAuthn)                           |

## Wallet Provider Types

When a credential has a `format` of `blockchain`, the `walletProvider` field indicates what type of wallet was used:

| Wallet Provider       | Description                                                          |
| --------------------- | -------------------------------------------------------------------- |
| `browserExtension`    | Browser extension wallet (MetaMask, Coinbase Wallet extension, etc.) |
| `embeddedWallet`      | Dynamic's embedded wallet                                            |
| `walletConnect`       | Wallet connected via WalletConnect protocol                          |
| `qrCode`              | Wallet connected by scanning a QR code                               |
| `deepLink`            | Wallet connected via deep link (mobile)                              |
| `custodialService`    | Custodial wallet service                                             |
| `smartContractWallet` | Smart contract wallet (account abstraction)                          |

## OAuth Provider Types

When a credential has a `format` of `oauth`, the `oauthProvider` field indicates which social provider was used:

| OAuth Provider | Description       |
| -------------- | ----------------- |
| `google`       | Google account    |
| `apple`        | Apple ID          |
| `discord`      | Discord account   |
| `twitter`      | Twitter/X account |
| `github`       | GitHub account    |
| `facebook`     | Facebook account  |
| `twitch`       | Twitch account    |
| `linkedin`     | LinkedIn account  |
| `microsoft`    | Microsoft account |
| `farcaster`    | Farcaster account |
| `telegram`     | Telegram account  |

<Note>
  See the full list of supported social providers in [Social Providers](/overview/social-providers/overview).
</Note>

## Iterating Through All Credentials

You can also iterate through all of a user's verified credentials to understand their full authentication history:

```tsx React Native theme={"system"}
import { dynamicClient } from '<path to client file>';
import { View, Text } from 'react-native';

const AllCredentials = () => {
  const user = dynamicClient.auth.authenticatedUser;

  return (
    <View>
      {user?.verifiedCredentials?.map((vc) => (
        <View key={vc.id}>
          <Text>Format: {vc.format}</Text>
          <Text>Identifier: {vc.publicIdentifier}</Text>
          {vc.format === 'blockchain' && (
            <Text>Wallet Provider: {vc.walletProvider}</Text>
          )}
          {vc.format === 'oauth' && (
            <Text>OAuth Provider: {vc.oauthProvider}</Text>
          )}
          {vc.id === user.lastVerifiedCredentialId && (
            <Text>(Last used)</Text>
          )}
        </View>
      ))}
    </View>
  );
};
```

## Determining Login Method Type with Helper Functions

Here's a helper function pattern you can use to easily determine the login method type:

## Related Resources

<Card title="Verified Credentials" href="/react-native/users/verified-credential" icon="shield-check">
  Learn more about the verified credential structure and all available fields
</Card>

<Card title="Accessing Users" href="/react-native/users/accessing-users" icon="user">
  Different ways to access user information in your application
</Card>
