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

# Telegram Social Login with Magic

> You can allow your users to sign up & log in to your web app with their Telegram account.

## Usage

### Prerequisites

* You will need to have the [Magic SDK installed](/embedded-wallets/sdk/overview) into your web app
* You will need to have the [Magic SDK - OAuth Extension](/embedded-wallets/authentication/login/oauth/oauth-implementation) installed into your web app

### Telegram Setup

After installing the OAuth extension, you can now enable Telegram Login for your Magic app:

1. Follow Telegram instructions to create a bot
2. Provide Bot name and Bot Token in your Magic developer dashboard
3. Optionally enable Seamless login with Mini App
4. Copy the Redirect URI field from your Magic Dashboard and set it as your bot domain using command `/setdomain` in @BotFather

<Note>
  If you have CSP enforcement, allow the following script-src:

  * [https://telegram.org](https://telegram.org)
  * [https://web.telegram.org](https://web.telegram.org)
</Note>

## Implementation

```javascript JavaScript icon="square-js" theme={null}
await magic.oauth2.loginWithPopup({
  provider: 'telegram'
});
```

The result interface:

```typescript theme={null}
interface OAuthRedirectResult {
  magic: {
    idToken: string;
    userMetadata: MagicUserMetadata;
  },
  oauth: {
    provider: string;
    scope: string[];
    accessToken: string;
    userHandle: string;
    userInfo: ...;
  }
};
```

<Note>
  The shape of `magic.userMetadata` (typed as `MagicUserMetadata`) differs by SDK version. On **SDK v30.0.0+**, wallet addresses are nested under a `wallets` object — access the Ethereum address via `result.magic.userMetadata.wallets?.ethereum?.publicAddress`. On **SDK v29.x and below**, the address is available as a flat field: `result.magic.userMetadata.publicAddress`. See the [`getInfo` SDK reference](/embedded-wallets/sdk/client-side/javascript#getinfo) for full response shapes and migration details.
</Note>

<Warning>
  Keep your token secure and store it safely, it can be used by anyone to control your bot
</Warning>

## Resources

* [Telegram Login Demo](https://github.com/magiclabs/telegram-oauth-demo)
