xmlsquad / xml-authoring-library

A place to put code that is reused by many commands which are part of the [xml-authoring-tools suite](https://github.com/forikal-uk/xml-authoring-tools).
Apache License 2.0
0 stars 0 forks source link

Ensure `GoogleAPIClient` can handle OAuth and Service type Google API Keys #5

Closed forikal-uk closed 5 years ago

forikal-uk commented 6 years ago

Goal

See issue summary

Why

I have some custom code which uses Service type authentication and would like to re-use alot of code that expects OAuth to be used.

How

Bring in the code that expects Service type authentication into the xml-authoring-libary and squeeze it into the GoogleAPIClient somehow.

forikal-uk commented 6 years ago

Move the old ghseet-to-xml GoogleClientFactory into the library

The old ghseet-to-xml GoogleClientFactory was in an old incarnation of ghseet-to-xml when it used Service key instead of OAuth.

I still have old custom command that was based on that.

By bringing in a GoogleClientFactory we now have a place to put code that decides how to create the GoogleAPIClient.

forikal-uk commented 6 years ago

I am going to abandon this task for now as it is too complex to deal with right now.

If anyone is going to take up this task. Then you can see the old incarnation of gsheet-to-xml where we changed from using a Google API Service Key to using Google API OAuth.

See the commit where we switched to OAuth (user login as opposed to application login) https://github.com/xmlsquad/gsheet-to-xml/commit/268d2e738160958d6cbd80c8ef38d8d42c4a4fe9

At some stage we want to be able to use either type of authentication in our suite of tools so that code can be re-used behind a web interface.

john-arcus commented 5 years ago

I have revisited this.

When both 'servicekeyfiel' and 'OAuth credentials and token file name' are passed in.

It uses the $preferServiceKey property on the command class to decide which authentication mechanism to use.