CreateOAuthStateResult CreateOAuthState(CreateOAuthStateArg tArg)
tArg. Operation execution parameters.
The CreateOAuthState operation gets the authorization service URL, by which access token will be requested.
To execute the operation, in the tArg.svcKey field specify authorization service key. The key can be obtained on executing the GetOAuthSettings operation.
The operation results in the authorization service URL that will be added with the generated state parameter to protect from potential CSRF attacks and to get authorization code. For details see the Setting Up Authentication via External Services section.
Below is the example of getting authorization service URL. The request contains authorization service key. The response contains the generated URL.
{
"CreateOAuthState" :
{
"tArg" :
{
"svcKey" : "0"
}
}
}
{
"CreateOAuthStateResult" :
{
"authUrl" : "https:\/\/accounts.google.com\/o\/oauth2\/auth\/authorize?client_id=214433571309-nl9btulcqc3u05d8128uaei3fjrdni8r.apps.googleusercontent.com&response_type=code&access_type=offline&scope=https%3A\/\/www.googleapis.com\/auth\/userinfo.profile&response_mode=query&state=ED9F5DF6E55440CDA86561A87A71CD33&redirect_uri="
}
}
public static CreateOAuthStateResult CreateOAuthState(uint key)
{
var somClient = new SomPortTypeClient(); // Proxy object for operation execution
// Operation execution parameters
var tCreate = new CreateOAuthState()
{
tArg = new CreateOAuthStateArg()
{
svcKey = key
}
};
// Get authorization service URL
var result = somClient.CreateOAuthState(tCreate);
return result;
}
See also: