FarmerOAuthTokens.GetOAuthConnectionLinkAsync Method
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Returns Connection link needed in the OAuth flow.
public virtual System.Threading.Tasks.Task<Azure.Response> GetOAuthConnectionLinkAsync (Azure.Core.RequestContent content, Azure.RequestContext context = default);
abstract member GetOAuthConnectionLinkAsync : Azure.Core.RequestContent * Azure.RequestContext -> System.Threading.Tasks.Task<Azure.Response>
override this.GetOAuthConnectionLinkAsync : Azure.Core.RequestContent * Azure.RequestContext -> System.Threading.Tasks.Task<Azure.Response>
Public Overridable Function GetOAuthConnectionLinkAsync (content As RequestContent, Optional context As RequestContext = Nothing) As Task(Of Response)
Parameters
- content
- RequestContent
The content to send as the body of the request. Details of the request body schema are in the Remarks section below.
- context
- RequestContext
The request context, which can override default behaviors of the client pipeline on a per-call basis.
Returns
The response returned from the service.
Exceptions
content
is null.
Service returned a non-success status code.
Examples
This sample shows how to call GetOAuthConnectionLinkAsync with required request content, and how to parse the result.
var credential = new DefaultAzureCredential();
var client = new FarmBeatsClient(credential).GetFarmerOAuthTokensClient(<2022-11-01-preview>);
var data = new {
partyId = "<partyId>",
oAuthProviderId = "<oAuthProviderId>",
userRedirectLink = "<userRedirectLink>",
};
Response response = await client.GetOAuthConnectionLinkAsync(RequestContent.Create(data));
JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement;
Console.WriteLine(result.ToString());
This sample shows how to call GetOAuthConnectionLinkAsync with all request content, and how to parse the result.
var credential = new DefaultAzureCredential();
var client = new FarmBeatsClient(credential).GetFarmerOAuthTokensClient(<2022-11-01-preview>);
var data = new {
partyId = "<partyId>",
oAuthProviderId = "<oAuthProviderId>",
userRedirectLink = "<userRedirectLink>",
userRedirectState = "<userRedirectState>",
};
Response response = await client.GetOAuthConnectionLinkAsync(RequestContent.Create(data));
JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement;
Console.WriteLine(result.ToString());
Remarks
Below is the JSON schema for the request payload.
Request Body:
Schema for OAuthConnectRequest
:
{
partyId: string, # Required. Id of the party.
oAuthProviderId: string, # Required. Id of the OAuthProvider.
userRedirectLink: string, # Required. Link to redirect the user to, at the end of the oauth flow.
userRedirectState: string, # Optional. State to provide back when redirecting the user, at the end of the oauth flow.
}
Applies to
Azure SDK for .NET