hoauth2 icon indicating copy to clipboard operation
hoauth2 copied to clipboard

Service Account

Open freizl opened this issue 9 years ago • 11 comments

Damian Soriano (Gmail) to me Aug 8 Hi!

I am creating a Haskell application that connects go bigquery. I wanted to use your OAuth2 lib to do that: https://github.com/freizl/hoauth2

I search a little bit in the doc and example and I didn't found anything about service account authentication (https://developers.google.com/identity/protocols/OAuth2ServiceAccount). I was wondering if that feature is already implemented in the lib or not, since I found no example about that.

Many thanks

Regards

freizl avatar Aug 26 '16 20:08 freizl

Hi,

I have just released few days ago a package called google-oauth2-jwt that create the signed JWT needed to access Google APIs with Service Accounts.

BTW: your issue #16 also need it.

Best regards, Michel.

MichelBoucey avatar Sep 07 '16 07:09 MichelBoucey

@MichelBoucey nice! will take an look.

freizl avatar Sep 07 '16 15:09 freizl

@MichelBoucey just be curious that are you able to build http://hackage.haskell.org/package/google-oauth2-jwt on latest mac? Gets linking error

Undefined symbols for architecture x86_64:
  "_DHparams_dup", referenced from:
      _HsOpenSSL_DHparams_dup in libHSHsOpenSSL-0.11.1.1-42cQLUu6Nm37qCxYZlRnxo.a(HsOpenSSL.o)
     (maybe you meant: _HsOpenSSL_DHparams_dup)
  "_X509_CRL_get0_by_serial", referenced from:
      _cZGG_info in libHSHsOpenSSL-0.11.1.1-42cQLUu6Nm37qCxYZlRnxo.a(Revocation.o)
  "_X509_STORE_CTX_get0_current_crl", referenced from:
      _HsOpenSSL_X509_STORE_CTX_get0_current_crl in libHSHsOpenSSL-0.11.1.1-42cQLUu6Nm37qCxYZlRnxo.a(HsOpenSSL.o)
     (maybe you meant: _HsOpenSSL_X509_STORE_CTX_get0_current_crl)
  "_X509_STORE_CTX_get0_current_issuer", referenced from:
      _HsOpenSSL_X509_STORE_CTX_get0_current_issuer in libHSHsOpenSSL-0.11.1.1-42cQLUu6Nm37qCxYZlRnxo.a(HsOpenSSL.o)
     (maybe you meant: _HsOpenSSL_X509_STORE_CTX_get0_current_issuer)
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
`gcc' failed in phase `Linker'. (Exit code: 1)

freizl avatar Sep 29 '16 08:09 freizl

I have no Mac. I work on Linux x86_64. I never have had this issue and the build on travis CI is also Okay... Do you build the package with Stack? Have you OpenSSL sources installed? There is an ongoing issue about building HsOpenSSL on Mac OS X.

MichelBoucey avatar Sep 29 '16 10:09 MichelBoucey

@MichelBoucey thanks your feedback. I did find that link which help to me to install the HsOpenSSL but I got error at linking. Turns out it's specific issue in Mac and I'm running it in CentOS now.

freizl avatar Sep 29 '16 17:09 freizl

@freizl RedHat/CentOS are very LTS distros, so they use very old versions of libraries and softwares. A successful build should be easer to get on a current Debian(-like) distro or ArchLinux.

MichelBoucey avatar Sep 29 '16 20:09 MichelBoucey

thoughts: maybe put it in an separated repo?

freizl avatar Oct 25 '16 00:10 freizl

Can't you develop the service account branch in a debian/archlinux docker container?

MichelBoucey avatar Oct 25 '16 07:10 MichelBoucey

I'm not yet an fan of docker container but I have bootstrapped an linux vm. It's still in progress in very low pace if you are interested: https://github.com/freizl/hoauth2/compare/branch/service-account?expand=1

And I'm wondering all those changes shall live in its own repo given it seems special to google implementation.

freizl avatar Oct 26 '16 15:10 freizl

I have built branch/service-account without any troubles on ArchLinux x86_64 (discarding all examples test searching for "Keys").

And yes it seems to me also that a specific package is a bit better outside an only generic implementation package, at least, in an obviously specific module Network.OAuth.OAuth2.Google .

MichelBoucey avatar Oct 27 '16 08:10 MichelBoucey

Network.OAuth.OAuth2.Google seems an good name. Thanks!

freizl avatar Oct 28 '16 15:10 freizl