外部IDを取得する方法

It looks like you are trying to get the user’s user_associated_account.provider_uid. From looking at the code, there is a hidden site setting that you need to enable to cause the associated_account_ids to be returned from the CurrentUserSerializer:

The include_associated_account_ids setting is hidden: discourse/config/site_settings.yml at main · discourse/discourse · GitHub. To enable it, enter your site’s Rails console and run:

SiteSetting.include_associated_account_ids=true

「いいね!」 3