-
Notifications
You must be signed in to change notification settings - Fork 8
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
Recommendations for handling OAuth 2 #462
Comments
Oops, you are using on-premise. So auth is working or not? Using the URL parameter is optional. I see in MicrosoftClientBuilder a comment on this: authenticator((url, requestHeaders) -> {
// some streaming endpoints object to auth so don't add header
// if not on the base service
if (url.toExternalForm().startsWith(b.baseUrl)) {
// remove Authorization header if present
List<RequestHeader> list = requestHeaders //
.stream() //
.filter(rh -> !rh.name().equalsIgnoreCase("Authorization")) //
.collect(Collectors.toList());
// add basic auth request header
UsernamePassword c = bc.get();
list.add(basicAuth(c.username(), c.password()));
return list;
} else {
return requestHeaders;
}
}); Anyway your approach looks good and is what other Dynamics builders look like too, like this finance one. |
BTW, I would normally use an auto-refreshing token retrieval approach so you only need one instance of the built |
You could adapt this from MicrosoftClientBuilder for refreshing tokens. We can discuss making MicrosoftClientBuilder a bit more flexible for on-premise too, we'll see what you find. |
Thank you for the information. We will look at |
Refactoring ClientCredentialsAccessTokenProvider and MicrosoftClientBuilder now to make it easier for on-prem. |
Here's an on-prem support PR for you to review if you like. I'll merge it soon if no response and build a new release. |
I looked over the code and this looks good. |
0.2.1 is on Maven Central now with on-prem support. |
Sorry about the delay, our project got placed on hold for a bit here and I'm just getting back to this. Microsoft recommends this format for ROPC
|
Sorry, I missed this, feel free to bump to get my attention. If we don't want to go down the ROPC requirements rabbit hole too deeply then an easy way of doing this is via the client builder which allows you to specify an |
My team is building an Android application to interface with Dynamics 365 CRM On-Premise and we will be using OAuth. I read through the odata-client-microsoft-client-builder source to try and piece something together. Are there any recommendations for implementing OAuth with Dynamics 365?
I did the following and found that my implementation does work, but I'm not confident that this is the 'correct' way to use
BuilderCustomAuthenticator
or theAuthenticator
interface.I copied the example from com.github.davidmoten.ms.dynamics.Dynamics and made these changes:
tenantName
basicAuthentication
methods withBuilderCustomAuthenticator<T> customAuthenticator(Authenticator authenticator)
Then I created my custom
Authenticator
by implementing theAuthenticator
interface. I ended up not using the URL parameter. Should I be using this parameter? If so, what for?Finally, I instantiate my client. The getAuthToken() method uses the username/password to retrieve an authorization token from ADFS and returns that token as a String.
The text was updated successfully, but these errors were encountered: