-
Notifications
You must be signed in to change notification settings - Fork 1k
"Token request previously failed" for any attempt to get a token using AadHttpClient #9793
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
Comments
Testing this in an incognito window/with cookies cleared does not resolve this issue either. |
By using a local override of my app in prod, I can see that the initial token request fails with: |
@andrewpeterson99 I may have jinxed myself. In my previous posts I mentioned that we only get the token errors sporadically but it just happened to everyone in our company and took down all of our SharePoint sites for 6 hours. I created an issue thinking it might have been widespread. #9828 After this, I think I'm going to remove the token generation code and replace it with my own version of tokens. I think we're only using the token to validate that someone making an API call is authenticated inside SharePoint. If that's the only reason, I think I can generate my own "token" after the user logs in, save it to the database and a cookie on their computer, and send the token with every API call. Before the API call retrieves data from the database I'll validate the token that was sent in the API call with one that is stored in the database for that user. It seems like it would work in my head but I'm not a security expert. |
Hello @andrewpeterson99, |
@andrewpeterson99,
This successfully returns a raw access token for Microsoft Graph, and I can see it logged in the console. Based on my understanding, this token can now be used to authenticate requests to the Graph API. Please let me know if my understanding is correct or if there's anything else I should consider (e.g., token caching, renewals, or best practices for using it in subsequent API calls). Thanks! |
@andrewpeterson99, Would appreciate your feedback—especially if there's anything I might be overlooking regarding token caching, renewals, or general best practices. |
It's been so long since I was working on this SharePoint app that I can't remember all the context behind this issue :( |
Target SharePoint environment
SharePoint Online
What SharePoint development model, framework, SDK or API is this about?
💥 SharePoint Framework
Developer environment
Linux
What browser(s) / client(s) have you tested
Additional environment details
Describe the bug / error
Some clients I'm working with have issues loading my Sharepoint integration on their site. For those clients who are experiencing the issue (which is not all of them), they get the following error:
This error is caused by the following lines in my application:
I've managed to repro this on a local test account, and no matter how many reinstalls I do of my Sharepoint app, the error still occurs. I have other accounts where the app works fine and token requests go through. I tried following the steps here, but they did not resolve the issue. I am happy to provide any more details that are required. This is quite a big issue for my application since I rely on the JWT provided by MS as part of the auth process in my application's backend.
Thank you for any help you can provide.
Steps to reproduce
This does not occur on every install of my application, and so I'm not sure exactly what's triggering it. However, this is what I have setup right now to repro it:
Expected behavior
A token is returned as part of the call w/out an error as mentioned above (copied here):
This error is caused by the following lines in my application:
The text was updated successfully, but these errors were encountered: