Configuring X login and rich embeds for Discourse

:bookmark: This guide explains how to set up Twitter login and rich embeds for your Discourse forum.

:person_raising_hand: Required user level: Administrator

:warning: In order for rich embeds to work properly, a Basic plan or higher for X Dev is mandatory. Rich embeds will not work with the Free X Dev plan.

X Configuration

  1. Go to the Developer Portal on X.

  2. Choose between a Free, Basic, or Pro X Dev plan and complete the developer agreement and policy requirements.

  3. After completing the agreement and policy requirements, you’ll be taken to the X dev dashboard.

Create a new project

  1. On your X Dev dashboard, click + Add Project.

  2. Complete the requested information:

    • Your project name
    • Use case. If you are using an account with a Basic or Pro plan, please select Embedding_Tweets_in_a_website.
    • Your project description (e.g., “Enable Twitter login and embeds on a Discourse forum”).
    • Select Production for the app environment. Note you may not be prompted to select the app environment.
    • Your app name
  3. You will be shown your API Key and API Key Secret. Please write these down so you can add them to your Discourse forum later.

  4. Click the App Settings button on the bottom right.

  5. Scroll down to the User Authentication Settings section and click the Set up button. Update the following fields:

    • App Permission → Read and enable Request_email_from_users
    • Type of App → Web App, Automated App or Bot
    • App info →
      • Callback URL / Redirect URL: https://yourdiscourseforum.com/auth/twitter/callback
      • Website URL: https://yourdiscourseforum.com
      • Terms of service: https://yourdiscourseforum.com/tos
      • Privacy Policy: https://yourdiscourseforum.com/privacy

  6. Click Save.

Discourse configuration

  1. Head over to your Discourse forum and enter the admin panel.

  2. Click the Settings button and choose Login to find the Twitter-related settings:

  3. Enable the enable_twitter_logins setting.

  4. Copy and paste the API Key from X into the twitter_consumer_key setting.

  5. Copy and Paste the API Key Secret from X into the twitter_consumer_secret setting.

  6. Click the green checkmark to save the changes.

Users should now be able to log into your forum using their Twitter Account.

Rich Embeds

The above steps also apply if you want to enable “rich embedding” which allows displaying tweets with their media (images video, etc). If you want rich embeds but don’t need Twitter login, simply uncheck enable twitter logins and leave the consumer key and secret intact.

:warning: Rebaking or rebuilding HTML for posts with tweets will re-fetch those tweets, counting against your monthly tweet cap.

Additional resources

Last edited by @sam 2026-03-18T04:43:33Z

Check documentPerform check on document:
75개의 좋아요

Note that the “Callback URL” field is now mandatory. If you omitted it in your setup, Twitter login will fail with a 403 unauthorized error.

Also note that if you have any extra spaces at the beginning or end of your callback urls, auth will fail. You can find other discussions about this change on the Twitter Community.

13개의 좋아요

Just noticed we were getting the same error on our site with Twitter auth. I noticed Twitter has a new process for authorizing developer apps, so we are going through the approval process. Not sure if it is related, or if this problem has just been in place for a long time now.

1개의 좋아요

I setup my callback URL like this on Twitter, but still getting the same error.
https://www.helloforos.com/auth/twitter

Does this look like the right format? What do you guys use?

I’m going to try it again tomorrow in case there’s some caching issue with Twitter

Anyone else have success with Twitter login?

@charleswalter That callback url is wrong. It should be:

7개의 좋아요

that did the trick. Thx for calling that out.

I do recommend that those who haven’t applied on developer.twitter.com for their Twitter app, to do so.

For the near future, you can continue to manage existing apps here on apps.twitter.com. However, we will soon retire this site and consolidate all developer tools, API access, and app management within the developer portal at developer.twitter.com. You will be able to access and manage existing apps through that portal when we retire this site.

5개의 좋아요

2020년 3월

트위터가 전체 프로세스를 변경했기 때문에 가이드를 완전히 다시 작성했습니다 … 또다시 :sweat_smile:

16개의 좋아요

Twitter, 작동하지 않는 것 같습니다

앱 생성을 추가할 수 없습니다

1개의 좋아요

저한테는 잘 작동합니다

그리고 https://api.twitterstat.us/ 를 보면 개발자 포털은 정상적으로 작동하고 있습니다.

아마도 소셜 미디어나 추적 등을 차단하는 확장 프로그램 같은 것을 사용 중이실 겁니다. 모든 확장 프로그램을 비활성화한 익명 창에서 로그인해 보시기 바랍니다.

4개의 좋아요

가이드가 업데이트되었습니다

7개의 좋아요

이 질문을 여기에 하는 것이 맞는지 모르겠습니다. https://try.discourse.org/에서 확인해 보니, Twitter로 가입하면 다음과 같은 메시지가 표시됩니다:

This application will be able to:

See Tweets from your timeline (including protected Tweets) as well as your Lists and collections.
See your Twitter profile information and account settings.
See accounts you follow, mute, and block.
See your email address.

이름과 이메일 주소처럼 최소한의 정보만 확인하도록 설정할 수 있을까요?

1개의 좋아요

이것은 이미 Twitter에서 요구하는 최소한의 정보입니다.

가이드에서 볼 수 있듯이, Twitter에서 요구하는 유일한 정보는 Discourse가 사용자 계정을 생성하는 데 필요한 사용자 이메일입니다. 나머지는 모두 App Permission 섹션에서 "Read only"를 선택함으로써 Twitter에서 결정되는 기본 설정입니다.

7개의 좋아요

안녕하세요, 트윗의 답글을 임베드하려고 합니다.

임베드는 다음과 같이 보여야 합니다.

현재는 답글만 표시되고, 원본 트윗은 함께 표시되지 않습니다.
Discourse에서 원래 이런 방식인 건지, 아니면 제가 무언가 잘못하고 있는 건지 궁금합니다.

2개의 좋아요

저는 트위터를 사용하지 않지만, 답글 링크는 원래 트윗의 링크와 다르다고 생각합니다. 따라서 당신은 답글에만 링크를 걸고 있는 셈이죠. 원래 트윗에 링크를 걸면 첫 번째 답글도 포함되나요, 아니면 원래 트윗만 포함되나요?

1개의 좋아요

Jimpas님, 안녕하세요.

아니요, 아이디어는 답글을 임베드할 때 이미지처럼 원본 트윗을 위에 함께 표시할 수 있도록 하는 것입니다. 이렇게 하면 답글에 맥락이 생깁니다.
스타일링도 꽤 마음에 듭니다.

현재는 답글만 가져오는 상태입니다.
우회 방법은 임베드를 두 번 사용하는 것입니다.

1개의 좋아요

사실 우회 방법으로는 맞습니다. 그런데 어떻게 원본 트윗을 답글 위에 배치하도록 선택할 수 있나요? 그렇다면 어떻게 "선택"하는 걸까요? 가끔 다른 웹사이트에서 원본 트윗이 첫 번째 답글 위에 있는 것을 보긴 합니다. :thinking:

저도 동일한 등록 문제를 겪고 있습니다. 테스트 계정을 사용하려고 할 때, 트위터가 등록 시 이메일이 액세스되고 있다고 표시해도, 트위터와의 인증 핸드셰이크를 완료한 후 계정 등록 양식에 이메일이 미리 입력되지 않습니다. 또한, 미리 입력된 사용자 이름이 "user_1"으로 표시됩니다. 리치 임베드도 작동하지 않습니다.

1개의 좋아요

불안해하지 말고 차분하게 기다려 주세요. Discourse 팀은 모든 게시물을 매우 꼼꼼히 읽기 때문에, 이미 이 문제를 파악하고 있을 것이라고 확신합니다. :slight_smile:

2개의 좋아요

@Hifihedgehog와 @dnfoz, 이 건은 배정되어 있으며 곧 검토하겠습니다. 이 설정과 로그인에 문제가 있는 다른 분은 계신가요?

4개의 좋아요

진행 상황 좀 알려줄 수 있을까요? 저도 같은 문제가 있습니다.

1개의 좋아요