public class ChainedTokenCredential extends Object implements TokenCredential
Sample: Construct a ChainedTokenCredential with silent username+password login tried first, then interactive browser login as needed (e.g. when 2FA is turned on in the directory).
UsernamePasswordCredential
usernamePasswordCredential = newUsernamePasswordCredentialBuilder
() .clientId(clientId) .username(username) .password(password) .build();InteractiveBrowserCredential
interactiveBrowserCredential = newInteractiveBrowserCredentialBuilder
() .clientId(clientId) .port(8765) .build();ChainedTokenCredential
credential = newChainedTokenCredentialBuilder
() .addLast(usernamePasswordCredential) .addLast(interactiveBrowserCredential) .build();
Modifier and Type | Method and Description |
---|---|
Mono<AccessToken> |
getToken(TokenRequestContext request) |
public Mono<AccessToken> getToken(TokenRequestContext request)
getToken
in interface TokenCredential
Copyright © 2019 Microsoft Corporation. All rights reserved.