Skip to content
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

microsoftTeams.authentication.getAuthToken is not working in sharepoint. #2322

Open
opentextshivam opened this issue May 13, 2024 · 4 comments

Comments

@opentextshivam
Copy link

microsoftTeams.authentication.getAuthToken is not working in sharepoint.

We are using below code snippet

  microsoftTeams.authentication.getAuthToken({
                successCallback: (result) => {
                   getMSGRAPHTokenFROMServer(result).then(function (accessTokenResponse) {
                        var graph_response = JSON.parse(accessTokenResponse.graph_response);
                        this._accessToken = graph_response.access_token;
                        dfd.resolve(true);                           
                    }.bind(this), function (error) {
                        dfd.reject(error);
                    })
                },
                failureCallback: function (error) {
                    dfd.reject("Error getting token: " + error);
                },

            });

It works find in Teams by not working in SharePoint.

@opentextshivam
Copy link
Author

opentextshivam commented May 13, 2024

Hi @ChetanSharma-msft ,

I am not using SPFX.
It's simple node js application.

Regards,
Shivam

@Nivedipa-MSFT
Copy link

@opentextshivam - Could you please share your repro video along with the repro steps, so that we will be able to repro at our end?

@AE-MS
Copy link
Contributor

AE-MS commented May 13, 2024

Unfortunately getAuthToken (and most of the teamsjs functions) are not supported when running your Teams app in SharePoint (for reference: #1407). Also unfortunately, the SharePoint team does not clearly document what does and does not work in this scenario. Their primary documentation page is here:
https://learn.microsoft.com/en-us/microsoftteams/platform/tabs/how-to/tabs-in-sharepoint
...but it doesn't nearly go to the level of detail needed (like support for individual capabilities or functions). As such, I will work with the SharePoint and documentation team to make the level of support clearer.

In the meantime, unfortunately getAuthToken (and most functions besides app.getContext().app.sharePoint) are not supported when Teams apps run in SharePoint.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants