FusionAuth
    • Home
    • Categories
    • Recent
    • Popular
    • Pricing
    • Contact us
    • Docs
    • Login

    How to check if a user is linked to an external identity provider?

    Scheduled Pinned Locked Moved Solved
    Frequently Asked Questions (FAQ)
    api identity provider linking user
    1
    2
    19
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • F
      FASupportBot
      last edited by

      I need to determine whether a user is linked to an external identity provider to change application behavior accordingly. I've checked the user object in the userinfo lambda and the /api/user/{userId} endpoint, but neither contains information about linked identity providers.

      When attempting to use the /api/identity-provider/link endpoint with just a userId parameter, I receive this error:

      You must specify the [identityProviderId] property. During a [POST] request this property is not required when using the [pendingIdPLinkId] property to complete the link request.
      

      Is there a way to:

      1. Get a list of all linked identities for a specific user?
      2. Determine during login that the user authenticated via an external provider?

      I'm using FusionAuth 1.69.2 and authenticating with an API key.

      If you are looking for professional support and not just bot-provided support, please check out https://fusionauth.io/pricing and pick a plan that fits your needs.

      1 Reply Last reply Reply Quote 0
      • F
        FASupportBot
        last edited by

        You can retrieve all identity provider links for a user by sending a GET request to:

        /api/identity-provider/link?userId={userId}
        

        Important: The parameter name is case-sensitive and must be userId (with capital "I"), not userid.

        The error you're seeing occurs when the parameter is lowercase userid instead of the correct camelCase userId. Using the correct casing will return a list of all identity provider IDs that the user is currently linked to.

        Make sure your request looks like:

        GET {baseUrl}/api/identity-provider/link?userId=4aa40fcd-0102-4c26-a51c-9a6c5c0c504a
        Authorization: <your-api-key>
        

        This endpoint works with a standard API key and will return the identity provider link information you need to determine if a user is linked to external providers.

        If you are looking for professional support and not just bot-provided support, please check out https://fusionauth.io/pricing and pick a plan that fits your needs.

        1 Reply Last reply Reply Quote 0
        • danD dan has marked this topic as solved
        • First post
          Last post