Connecting to Repository with External Service Authentication

Below is the example of using the OpenMetabase operation for connecting to repository of the user who was authenticated in external service. It is assumed that all required operations are already executed and their results are obtained. The request contains the repository description identifier, previously obtained status key, which stored tokens, and authentication service settings key. The response contains the repository connection moniker.

SOAP request:

<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/">
<s:Body xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<OpenMetabase xmlns="http://www.fsight.ru/PP.SOM.Som">
<tDef xmlns="">
  <id>WAREHOUSE</id>
  </tDef>
<tCreds xmlns="">
<oauth>
  <oauth_token>g0ZGZmNjVmOWI</oauth_token>
  <oauth_verifier />
  <svcKey>0</svcKey>
  </oauth>
  <pass />
  </tCreds>
  <tArg xmlns="" />
  </OpenMetabase>
  </s:Body>
  </s:Envelope>

SOAP response:

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
<soapenv:Body>
<OpenMetabaseResult xmlns="http://www.fsight.ru/PP.SOM.Som" xmlns:q1="http://www.fsight.ru/PP.SOM.Som" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
  <id xmlns="">DPEAJGROMGHGGOAECDBOBOCJCPGMIIEEKJEBOPGBJKEJKAEH!M</id>
  <sessKey xmlns="">394186</sessKey>
  <sessCookie xmlns="">C1</sessCookie>
  <version xmlns="">166</version>
  <defLocale xmlns="">1049</defLocale>
  <driver xmlns="">2</driver>
  </OpenMetabaseResult>
  </soapenv:Body>
  </soapenv:Envelope>

JSON request:

{
"OpenMetabase" :
{
"tDef" :
{
"id" : "WAREHOUSE"
},
"tCreds" :
{
"oauth" :
{
"oauth_token" : "g0ZGZmNjVmOWI",
"oauth_verifier" : "",
"svcKey" : "0"
},
"pass" : ""
},
"tArg" : ""
}
}

JSON response:

{
"OpenMetabaseResult" :
{
"id" : "DPEAJGROMGHGGOAECDBOBOCJCPGMIIEEKJEBOPGBJKEJKAEH!M",
"sessKey" : "394186",
"sessCookie" : "C1",
"version" : "166",
"defLocale" : "1049",
"driver" : "2"
}
}
public static MbId MetabaseConnectWithOauth(string mbDefinitionId, string token, uint key)
{
var somClient = new SomPortTypeClient(); // Proxy object for operation execution
// Operation execution parameters
var tOpen = new OpenMetabase()
{
tArg = new OpenMetabaseArg() { },
tCreds = new UserCreds() // Credentials used for connection
{
oauth = new OAuthLogonData()
{
oauth_token = token,
oauth_verifier = "",
svcKey = key
},
pass = string.Empty
},
tDef = new MbDef() // Description of repository, to which connection is established
{
id = mbDefinitionId
}
};
// Repository connection
MbId mb = somClient.OpenMetabase(tOpen);
return mb;
}

See also:

OpenMetabase