How to know if current user is an linked account?

Created on 15 April 2024, 9 months ago
Updated 30 April 2024, 8 months ago

Thanks for this module.

I have a question about the API/Service provided by this module.

Is there a way to figure out if the current login user is linked to a external account? API? Service function?

Thanks.

💬 Support request
Status

Fixed

Version

2.0

Component

Documentation

Created by

🇦🇺Australia mingsong 🇦🇺

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

  • Issue created by @mingsong
  • Status changed to Needs work 9 months ago
  • 🇧🇪Belgium svendecabooter Gent

    You could use

    \Drupal::service('externalauth.authmap')->getAll(\Drupal::currentUser()->id());
    

    This will return an empty array if the current user is not linked with an external service, or an array keyed by provider ID if they are.

    A more developer friendly service method could be added for this purpose I guess..

  • Status changed to Fixed 8 months ago
  • 🇦🇺Australia mingsong 🇦🇺

    Thanks @Sven

  • Automatically closed - issue fixed for 2 weeks with no activity.

Production build 0.71.5 2024