bimi82
Nintex Newbie

Call web request with REST API and OAuth 2.0

Jump to solution

Hello All


We use SP2016 onprem with Nintex 2016 Workflow v.4.6
I am looking for a way to use the Web Request to authenticate to a service via REST APPI and OAuth.

 

Is this possible?

The provider we use [Dracon] have stated this:

 

In order to obtain a token, you need to send a POST request to our token endpoint https://[host]/oauth/token

POST
Header:
Authorization: Basic $client_auth

Body:
grant_type = password
username = $user_name
password = $password

 

You need an OAuth client to authenticate – for simplicity, we used the client "DRACOON Legacy scripting support". Once the flow works correctly, it can be updated to a custom own app.
The variable $client_auth​ consists of a Base64-encoded string of $clientID:$clientSecret​
For the above mentioned OAuth client, the Client ID is dracoon_legacy_scripting and there is no client secret, therefore the string to convert to Base64 is dracoon_legacy_scripting:​ and equals ZHJhY29vbl9sZWdhY3lfc2NyaXB0aW5nOg​.

 

I have tried to perform the steps by using the WEB REQUEST:

WebRequest_OAuth2.JPG

When executed the following error appears:

 

Response status code: 401

Response content:
{"error":"invalid_client","error_description":"Client authentication needed."}

 

 

Viewing the process via F12 > Network > JSON Response

 

"Response status code: 401\r\n\r\nResponse content:\r\n{\"error\":\"invalid_client\",\"error_description\":\"Client authentication needed.\"}\r\nResponse headers:\r\nAccess-Control-Allow-Origin=*\r\nAccess-Control-Allow-Credentials=true\r\nAccess-Control-Allow-Methods=HEAD, GET, POST, PUT, DELETE, OPTIONS\r\nAccess-Control-Allow-Headers=content-type, authorization\r\nAccess-Control-Max-Age=3600\r\nPragma=no-cache\r\nvary=accept-encoding\r\nTransfer-Encoding=chunked\r\nConnection=close\r\nX-Frame-Options=DENY\r\nStrict-Transport-Security=max-age=63072000; includeSubDomains; preload\r\nX-Content-Type-Options=nosniff\r\nX-Xss-Protection=1; mode=block\r\nX-Robots-Tag=none\r\nCache-Control=no-cache, no-store, max-age=0, must-revalidate\r\nContent-Type=application/json\r\nDate=Mon, 11 Jan 2021 14:40:44 GMT\r\nExpires=0\r\nWWW-Authenticate=Basic,Form\r\n\r\nResponse cookies:\r\n\r\n"

 

 

Not sure what all this means ... can somebody help / assist please?

Can the Nintex developers or seniors or whowever advise if the I am able to use the OAuth within Nintex Workflow 2016 onprem? If so, what needs to be done?

 

Cheers

Tags (3)
0 Kudos
Reply
2 Replies
bimi82
Nintex Newbie

Re: Call web request with REST API and OAuth 2.0

Jump to solution

UPDATE

 

I figured out that the value for the Authorization attribute, needed the Basic word. In other words the TokenValue needed to have the Basic word in front of it seperated by a space.

 

 

Basic TokenValue

 

 

Now, the token is given by the OAuth server.

The result is stored into a Variable: StoreResults [MultiLine of Text].

 

Next challange:

 

- to crawl through the [StoreResults] variable

- look out for the TokenValue which starts with "access token":"

- store the TokenValue into a Strong [theToken]

 

 

View solution in original post

0 Kudos
Reply
bimi82
Nintex Newbie

Re: Call web request with REST API and OAuth 2.0

Jump to solution
0 Kudos
Reply