LogoLogo
  • Sign-In with Ethereum
    • ⭐Quickstart Guide
      • Creating SIWE Messages
      • Implement the Frontend
      • Implement the Backend
      • Connect the Frontend
      • Implement Sessions
      • Resolve ENS Profiles
      • Resolve NFT Holdings
  • Libraries
    • ⌨️TypeScript
      • Migrating to v2
      • TypeScript Quickstart
    • 🦀Rust
    • 🍷Elixir
    • 🐍Python
    • 💎Ruby
      • 🛤️Rails
    • 💨Go
  • Integrations
    • 💬Discourse
    • 🛡️NextAuth.js
    • 🖼️Auth0
  • Additional Support
    • 🔓Security Considerations
    • 📇ENS Profile Resolution
    • 🫂Community Highlights
  • Servers
    • 🖥️OIDC Provider
      • ⭐Deployment Guide
      • 🔒Hosted OIDC Provider
  • General Information
    • 📒SIWE Overview
      • 📜EIP-4361
      • 🔍Review of Related EIPs
    • 🚨SIWE Code of Conduct
Powered by GitBook
On this page
  1. Additional Support

ENS Profile Resolution

Resolve ENS Profiles for users signing into a service

PreviousSecurity ConsiderationsNextCommunity Highlights

Last updated 3 years ago

Requirements

  • >= v5.5.3

The user's linked (ENS) information can be retrieved after their Ethereum address is known. After the user connects with their wallet but before they Sign-In with Ethereum, ENS information can be used to provide additional context to the user about which account is connected.

If the user completes Sign-In with Ethereum to authenticate, the ENS data resolved from their Ethereum address may be used as part of the authenticated session, such as checking that the address's default ENS name is alisha.eth before granting access to certain pages or resources.

The information can be retrieved using :

import { ethers } from 'ethers';

const provider = new ethers.providers.EtherscanProvider()
const address = '0x9297A132AF2A1481441AB8dc1Ce6e243d879eaFD'

const ensName = await provider.lookupAddress(address)
const ensAvatarUrl = await provider.getAvatar(ensName)

const ensResolver = await provider.getResolver(ensName)
// You can fetch any key stored in their ENS profile.
const twitterHandle = await ensResolver.getText('com.twitter')

The user's Avatar location can be resolved using ensResolver.getText, butgetAvatar is recommended as it resolves NFT avatars to a URL.

The EtherscanProvider above uses a shared API key and is therefore rate-limited. For a production application, we strongly recommend using a new API key with or .

📇
ethers
Ethereum Name Service
the ENS resolution methods in ethers
Etherscan
another compatible provider