Condividi tramite


FarmerOAuthTokens.GetOAuthConnectionLink Method

Definition

Returns Connection link needed in the OAuth flow.

public virtual Azure.Response GetOAuthConnectionLink (Azure.Core.RequestContent content, Azure.RequestContext context = default);
abstract member GetOAuthConnectionLink : Azure.Core.RequestContent * Azure.RequestContext -> Azure.Response
override this.GetOAuthConnectionLink : Azure.Core.RequestContent * Azure.RequestContext -> Azure.Response
Public Overridable Function GetOAuthConnectionLink (content As RequestContent, Optional context As RequestContext = Nothing) As 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 GetOAuthConnectionLink 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 = client.GetOAuthConnectionLink(RequestContent.Create(data));

JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement;
Console.WriteLine(result.ToString());

This sample shows how to call GetOAuthConnectionLink 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 = client.GetOAuthConnectionLink(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