OAuth 1 and 2 using out of the Box Clarion Code

Do we have anything in clarion that caters for O Auth 2 .

The goal here is to connect via Clarion base code to a TAX Department and then stream the data back and forwards.

looking for NON DOT NET solution ASAP.

Does “out of the box” mean no Clarion accessories?

If so, I’d imagine you’ve got a bit of coding ahead of you.

If you want to pay for someone else’s code, NetTalk does Oauth. NetTalk OAuth

OA 2 required.

CPP is acceptable also.

If Nettalk solution is Clarion or CPP it will be acceptable.

what ever the software solution we will be plugging it into a bindable scripting engine .

standard clarion code can be plugged in using a wrapper interface and clarion supports

Interface com

which means what ever solution we use will end up being exposed via call able script .

script command will look like…


and run in any script text file or application bound at runtime…

as long as bruce does not mind the binding to his lower level API’s NETTALK should do the job.

NetTalk Desktop level is what you need here.

So, to answer the last part first;

as long as bruce does not mind the binding to his lower level API’s NETTALK should do the job.

I don’t mind. But OAuth is not “lower level API’s”. NetOAuth is a clarion class which is described and documented at NetTalk OAuth. It makes use of the NetTalk DLL which is free to ship, and OpenSSL DLLs which is also free to ship. None of this is dot net. (NetTalk DLL is Clarion, OpenSSL is in C)

I think you really want to spend some time reading and digesting that, because OAuth is a multi-step process where some of it takes place “out of process”.

There are also various flavours to OAuth; (apart from the obvious OAuth1.1a and OAuth2 difference - mostly everyone is on OAuth 2 now) - apart from that there’s also normal OAuth, PKCE Flow, Client-Credentials, and Password Grant. All are implemented by the object.

Typically, if you are using normal flow, or PKCE flow, then the end-user will need to interact with the parent site in an HTML control. Some sites (google for example) require that this happens out-of-process in an external browser. Most other sites allow the control to be in the program (ie something like Chrome Explorer (CapeSoft Chrome Explorer) but it’s your choice to do it in-process out out-of-process.

So yeah, OAuth is “easy” with NetTalk, and quick to do, but you need to understand what it is you are doing. Once you understand OAuth flows then it’s simple. But it’s worth spending an hour working through the docs and examples to get an idea of how it all fits together.

I did a webinar on OAuth (Episodes)

1 Like

No, OAuth support first came to NetTalk in NetTalk 10 and has been updated a fair bit since then (we’re now at NetTalk 12.) NetTalk has some additional requirements (see CapeSoft NetTalk) and only works in Clarion 8 or later.


Our wrapper template for the Chilkat Comms library includes a full OAuth2 class - and connecting to an Oauth2 source via Clarion is extremely easy - just prime up a pre-defined clarion group with the details of the OAuth2 endpoint and then call the “Connect” method. Once the user has completed the OAuth2 process via the browser, all the relevant tokens (Access and Refresh etc) and passed back to you in a pre-defined group.

We use this exact approach within other parts of the Chilkat wrapper ourselves - eg, the QuickBooks Online task class and Google Task Class etc etc…

Hope this helps,


Andy I’m sure I recall video of you showing how your OAuth works. Maybe you recall if it’s in an open webinar, or if it was for CIDC, or both? The video makes it easy to understand.

Hi Carl,

I’ll take a look, but its probably changed since then - where we added an easier interface for the developer to the base OAuth2 class.

I’ll cover it during the start of today’s usergroup webinar - that way, it’ll be fresh and up to date :slight_smile:

Thanks for the idea Carl :slight_smile:



As promised, I covered connecting to an Oauth2 API during today’s webinar.

The video is available here :- noyantis User Group Meeting - 2023.02.06 - YouTube



1 Like

Im sure many people will be interested in OA1 -2 .

our connection scripting engine runs on linux as well. In fact linux is it main target not windows.

The clarion connection for the source is compiled in MS VS as a windows test.

I think Bruces OA will be the best fit for the windows compiled solution as we already have a copy of Net Talk 7 and it does not use OCX.

we will probably upgrade slowly to NetTalk latest version when we have time.

The first step will be to Hack the Nettalk classes with a bindable interface.

That will run faster than a late bound connection.

To hack the class will require Bruces OK and he appears to be amenable.

The same as we have added an interface to the DLIB code and repacked it.

Creating a Hacked Class in Clarion that allows the class to act as a callable service from script code in a DLL instance or on a Server Instance of the Engine. Server version means exactly that. A callable service on a network server or over the Internet.

        NetTalkLoad(long IScriptCodeApIInterface),proc,long,name('NetTalkLoad'),pascal


! in Clarion Hacked Class 

  NetTTalkClass   class(),Type,|
		implements(**UIS)** // Hacked interface

NetTalkClass.Initalise      Procedure(String ObjectName,string MetaName,String ServiceName)

 Bindindobj   cstring(25)   ! CPP engine takes a bindable Name and ID Number. 
  Bindindobj = 'OAUTH'
  b# = IUniBindatypesref.IBind(Bindindobj,address(**self.UIS**),XObjectTypes:NetTalk,0)  

  ! In CPP - class bound direct into the Engine creating a client
  ! service inside the execution.

int CALL_TYPE uniscriptexprcontainer::**Binding**(int bindingtype, int bindinterface)
	// already supported in UniBindabletypes::Bind.
	int bindableaddress=0;

	if (bindingtype == 1) {

		UniscriptSingleEvents *bi;
		bi = (UniscriptSingleEvents*)bindinterface;

                // push the external interface in a new bindable object interface into the API SINK.
		this->iuniscriptevent = createBindObjectInterface("", this->iUniScriptExpressionref, bi, 0, 0);

In fact why not wrap NETTALK Server in as a Service with basic commands and then we get an installable stand alone Internet Server that distributes across the Western World.


OAUTH. methods and properties…

SQLLT. Statements


We have already tested a App Script Event Container to allow compiled code and script code to live together and call each other…

We have already tested a Runtime AnyScreen Hack.

What does a real world script look like that process stock market transactions off a Financial NZX stock broking service. This example is processing the unaudited transactions trading account from Direct Broking (ANZ bank New Zealand). Dead simple and it produces multi ledger trail balances with no user GUI required. Trail balances that are sub ledgers that conditionally total to a runtime denoted consoliated trial balance view.

This is the benefit of applications that are created as OOP Clarion bound to script interfaces.
Not even an IF statement or LOOP required in this one or script class or object call. The CPP engine has no idea its calling Clarion class instances.



TRIALBALANCEWKS.ADD('ABC','2022','650','Shares On Hand at Year End');

OMC.ACCOUNT.SETIMPORTDATE('ABC OMCCASH','01/04/2021','31/03/2022');    
OMC.ACCOUNT.PROCESS('ABC OMCCASH','CASH','01/04/2021','31/03/2022');
OMC.ACCOUNT.SETIMPORTDATE('ABC OMCRETAILNZD','01/04/2021','31/03/2022');    

Now in NetTalk 7 the methods are all string, long and a few basix others.


ClarionToUnixDate      Procedure (Long p_Date,Long p_Time=0),Long,VIRTUAL
UnixToClarionDate      Procedure (Long p_DateTime),Long,VIRTUAL
UnixToClarionTime      Procedure (Long p_DateTime),Long,VIRTUAL
_FindField             Procedure (*File p_File,String p_Field),Long,Virtual
_SetLabel              Procedure (*File p_File,Long p_x),String,Virtual
_FindKey               Procedure (*File p_File,String p_Name),Long,Virtual
_FindKeyField          PROCEDURE (File p_File,Key p_key),*? ,VIRTUAL
_ClearKeyFields        PROCEDURE (*File p_File,*Key p_key),VIRTUAL
_SaveFields            PROCEDURE (*File p_File,*Key p_key,Long p_To,<String p_prefix>),VIRTUAL
_RestoreFields         PROCEDURE (*File p_File,*Key p_key,Long p_From,<String p_prefix>),VIRTUAL
Popup                  Procedure(<String p_Text>,Long p_Send=0),VIRTUAL
Message                Procedure(String p_div,<String p_message>,<String p_class>,Long p_Send=0),String,Virtual,Proc
Busy                   Procedure(Long p_Send=0),STRING,PROC, VIRTUAL
AddLog                 Procedure(String p_Data),Virtual
MakeErrorPacket        PROCEDURE (long p_ErrorNumber, string p_ErrorString, string p_ErrorDescription, Long p_DefaultHeader=1),STRING ,VIRTUAL
_BounceView            PROCEDURE (VIEW p_View),Virtual
Translate              PROCEDURE (<String p_String>,Long p_AllowHtml=0),STRING,VIRTUAL

There is also the VIEW and the FILE types.

Well you might say you need a compiled View and File for NetTalk to function but do you.

Those who have seen the code for runtime data structures will know this is not so. In fact Queue is not a compiled data structure but some longs that point to a definition where the runtime can make get information about a Queue.

Connect a runtime service for clarion data structures and connect NetTalk to a Runtime service scripting engine and NETTALK back ends a service.

It no longer has to live inside a compiled program…its free then to roam the plains and go where ever it wants.