-
Notifications
You must be signed in to change notification settings - Fork 2.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Teams app custom tab: BrowserAuthError: redirect_in_iframe: Code flow is not supported inside an iframe #2531
Comments
Doesn't work for me either |
If I change the strategy from redirect to popup:
I get this error:
|
@goldylucks Are you using the Teams JS SDK (as demoed here)? |
I'm using |
This issue has not seen activity in 14 days. It will be closed in 7 days if it remains stale. |
Any updates on this? I have the same issue. |
For me also, appears this when logout user:
It appears before redirection, so technically doesn't affect to my flow but leave this awful error in the console. |
@kenny-reyes Currently this is expected. We will be making improvements to logout in #2546 and #2563. |
Happens to me at logon too. Is there a workaround yet? |
Update: We will have a proper sample for this scenario, but if you are getting this error, it is because you are trying to call You need to use the Teams JS SDK:
Example: // auth.js
const msal = new PublicClientApplication({
auth: {
clientId: "your-client-id",
authority: `https://login.microsoftonline.com/common`, // may need to replace with tenanted endpoint
redirectUri: `${window.location.origin}/auth-end`,
navigateToLoginRequestUrl: false
}
})
// tab.js (when auth is needed)
microsoftTeams.authentication.authenticate({
url: window.location.origin + "/auth-start",
width: 600,
height: 535,
successCallback: (result) => {
// This will be called when microsoftTeams.authentication.notifySuccess is called from the popup
},
failureCallback: (error) => {
// This will be called when microsoftTeams.authentication.notifyFailure is called from the popup
}
});
// auth-start.js (on page load)
msal.loginRedirect()
// auth-end.js (on page load)
msal.handleRedirectPromise()
.then(result => {
microsoftTeams.authentication.notifySuccess(result);
})
.catch((error) => {
microsoftTeams.authentication.notifyFailure(error);
}) |
And if you want to use the Teams OBO token to get SSO, you will need to trade it server-side, as demonstrated here: https://github.com/OfficeDev/microsoft-teams-app-quickstarts/blob/master/js/clients/tabs/tab-personal-sso/src/components/Tab.js#L68 We'll have a sample that shows both approaches using MSAL Browser and MSAL Node. |
This issue has not seen activity in 14 days. It will be closed in 7 days if it remains stale. |
This issue has been closed due to inactivity. If this has not been resolved please open a new issue. Thanks! |
Library
@azure/msal-browser@2.3.1
Framework
React
Description
We have a ms teams app with a chatbot tab and a custom tab.
In the custom tab, calling
msalInstance.loginRedirect({ scopes: [] });
throws the error below.In the chatbot tab, opening an iframe with the exact same screen as the custom tab, and calling the same command
msalInstance.loginRedirect({ scopes: [] });
works just fine.Error Message
Security
No
Regression
No
MSAL Configuration
Reproduction steps
Make a custom tab inside a ms teams app with the following code:
Expected behavior
It should trigger ms auth process with redirect and respond with an access token.
Browsers/Environment
The text was updated successfully, but these errors were encountered: