-
Notifications
You must be signed in to change notification settings - Fork 2k
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
[QUERY] Support needed setting up client credential flow with Spring Boot app #22642
Comments
Hi @BillyBolton, someone from the /cc @stliu |
Update: Unfortunately, I'm still getting the same sign-in flow though, which makes me think there's an issue on the Spring boot configuration. Would you be able to clarify what the applications.yml file needs to look like for this flow? (I've been looking at the documentation and it's really not clear).
|
Hi, @BillyBolton . Thanks for reaching out. Could you please try this:
And I'll create a PR soon about the docs and sample project. |
Hi, @BillyBolton. I tested it just now by this PR: #22717 .
Please make sure these steps are right:
If you still have problem about client-credential type, please:
|
Hi @chenrujun, thanks for sending all of that over. I realized I was using the wrong oauth dependency that was prompting the sign-in flow. This part is resolved. Unfortunately, I'm getting a 401 response both in your sample and mine so I think there's a permission issue in my web-app configuration. For what it's worth, here is my sample. Do you know what I should be looking at closer for this? |
Hi, @BillyBolton. Thanks for your response. Could you please try to add I have a plan to delete Refs:
|
Hi @chenrujun, looks like I'm still getting a 401. I'm starting to wonder if this has something to do with my controller though. I've pushed an update to my sample based on how to preauthorize with application permissions. Can you take a look at this sample? Below are my manifest files for the web-app and web-api. Note: these are just dummy apps so credentials will be discarded after I can get this going. To run my sample, from the app's top directory, in terminal type and run: Let me know your thoughts once you can take a closer look. API Manifest
Web-App Manifest
|
Hi, @BillyBolton , I created a PR: You can add a break point at This request can not get access_token. You said that:
Could you please compare the request to your request in Postman? |
Hey @chenrujun, Sorry, I'm not clear where to find the DefaultClientCredentialsTokenResponseClient.java file, but this seems handy for troubleshooting. Can you walk through how to get there? I merged your PR on my sample and I saw what you meant about not getting the access_token:
This is strange because, as mentioned, I can get one from Postman. Here's how I generate that request: This generates the following token:
And that token decodes to:
As we can see, the aud and roles line up with what I have setup in Azure. I'm not sure what the difference is though. |
Hi, @BillyBolton , I reproduced your problem with your configuration. Now I can run your project with my application.yml: Here is my resource-server's configuration: Here is my web-application's configuration: So there must be something wrong with your application.yml |
Hey there @chenrujun, Great news, I'm no longer getting the same error after re-creating the client-app and resource-server as per your recommendation. Thanks for pointing this out, although I'm not sure what the problem is. Happy to see this change though. :) As you can see, the token contains the app role I've configured. I'm able to access the page (as opposed to before), however when I I've updated my sample if you want to take a look for more clarity. Note: the api endpoint I use sometimes needs to be woken up and might pre-maturely close the connection on the first call. Just try again and it should be okay. FYI. |
Hi, @BillyBolton , I added a comment in your PR: https://github.com/BillyBolton/client-credential-sample/pull/2/files#r666592832 |
Hi, @BillyBolton , |
Hey @chenrujun, I was going to investigate one more thing but I think I will open a separate issue if that arises. Indeed, my initial problem has been solved. My team and I agree that the documentation for Azure Authentication with Spring apps is difficult to navigate, but I appreciate your quick responses helping me through. I wish I had reached out sooner! (I've been looking at this for longer than I care to admit.) Thank you again for all your help. You were fantastic! |
Update roleManagementAlertOperations properties (Azure#22642) * Start updating paths * update all paths and examples * Change patch operations to 204 instead of 200 * Update operations paths * Add new properties to operation * Update RoleManagementAlerts.json * Delete GetAlertOperations.json * Update GetAlertOperationById.json * Fix accidental comma deletion * Update GetAlertOperationById.json * Update RefreshAlert.json * Update RefreshAllAlerts.json * Update RefreshAlert.json * Fix date formatting * Fix date format * Fix date format * Update RefreshAlert.json * Remove unused type * Add remediatable to custom words
Query/Question
Question also posted on StackOverflow here.
I'm trying to setup client credential flow with a Spring app to access a web api (both owned by myself). I've attempted to follow the Azure documentation Microsoft identity platform and the OAuth 2.0 client credentials flow and Quickstart: Configure a client application to access a web API but I'm running into a few problems because the documentation is not clear. Somewhere in my setup, Azure is forcing the user to sign-in, and then other error messages sprout from there. As we know, however, client credential should be machine to machine authorization so I'm not sure why this sign-in flow is happening.
Below are some photos of my setup from Azure and the applications.yml file. Any feedback would be helpful getting me up running.
application.yml
Why is this not a Bug or a feature Request?
A clear explanation of why is this not a bug or a feature request?
Setup (please complete the following information if applicable):
Information Checklist
Kindly make sure that you have added all the following information above and checkoff the required fields otherwise we will treat the issuer as an incomplete report
The text was updated successfully, but these errors were encountered: