how to login with firebase email link to a microsoft teams tabs app

Guy Kedar 1 Reputation point
2021-09-09T12:25:36.22+00:00

I am trying to create an app with Microsoft teams where I basically host an existing web app within a tab.

In that web app, the sign-in is via Firebase email links.

The user enters an email address, gets an email with a link that should bring him back to the app, and log him in.

The problem is that I couldn't find a way for the web app to get access the original URL the user got in the email because the tab will always pass the same URL to the web app as defined in the manifest.

The closest I got is building a deep link to ms teams for the URL that is sent in the email

const actionCodeSettingsTeams = {
  // URL you want to redirect back to. The domain (www.example.com) for this
  // URL must be in the authorized domains list in the Firebase Console.
  url: 'https://teams.microsoft.com/l/entity/extity-id/app

  handleCodeInApp: true,
};

       await firebase
          .auth()
          .sendSignInLinkToEmail(
            data.email,
           actionCodeSettingsTeams,
          );

So the user is redirected back to the correct tab

but when checking firebase.auth().isSignInWithEmailLink(window.location.href) it will always return false since the original URL called from the email is gone and the web app only gets the URL defined in the app manifest for that tab.

Microsoft Teams
Microsoft Teams
A Microsoft customizable chat-based workspace.
9,073 questions
Microsoft Teams Development
Microsoft Teams Development
Microsoft Teams: A Microsoft customizable chat-based workspace.Development: The process of researching, productizing, and refining new or existing technologies.
2,846 questions
{count} votes

1 answer

Sort by: Most helpful
  1. Hunaid Hanfee-MSFT 976 Reputation points
    2021-09-16T18:12:12.85+00:00

    Hello @Guy Kedar ,
    I find one thing that might be used in your scenario. The subEntityId parameter that you can add in your deeplink and make use of it.

    Follow this doc for more information - Generate a deep link to your tab

    https://teams.microsoft.com/l/entity/<appId>/<entityId>?context={"subEntityId":"useThisValue"}  
    

    You need to get first context and you can access it like context.subEntityId

    microsoftTeams.getContext((context) => {  
        if (context) {  
            this.setState({ teamsContext: context });  
        }  
    });  
    

    Hope this helps.
    Other than this I didn't find anything that can be used in your scenario.

    Thanks,
    Hunaid Hanfee


    If the response is helpful, please click "Accept Answer" and upvote it. You can share your feedback via Microsoft Teams Developer Feedback link. Click here to escalate.

    1 person found this answer helpful.
    0 comments No comments