Closed absolutejam closed 5 years ago
Hi @absolutejam I added the RS token support so we could talk to google. Here is the code we're using in production - at some point I'll get around to building a google shard
https://gist.github.com/stakach/5b4b658628773dcbce0a8cc4181bd5e0
This works for us on OSX, Ubuntu and RedHat - not sure if they are using Libre or Open. The format of the private key should be like:
pkey = "-----BEGIN PRIVATE KEY-----\nMIIEvgIBADANBgkqhki...\n-----END PRIVATE KEY-----\n"
Usage for the gist code above looks like:
signing_key = "-----BEGIN PRIVATE KEY-----..."
issuer = "user@service.iam.gserviceaccount.com"
scopes = "https://www.googleapis.com/auth/calendar"
auth = GoogleAuth.new(issuer, signing_key, scopes)
gcal = GoogleCalendar.new auth
gcal.sub = "user@domain.com"
gcal.events("user@domain.com", period_end: Time.local.at_end_of_day)
# returns todays event list for that user
Let me know how you travel. My guess would be the PKey is in the wrong format or the wrong param is being passed?
Oh! I was using the OAuth client secret as the second parameter instead of the private key from the .json!
Thanks for your help :smile:!
@absolutejam our google library is up https://github.com/PlaceOS/google
Hey there!
Thanks for creating this shard; we need more great shards like this.
I'm trying to generate a JWT for Google OAuth2 but I'm hitting the following unhandled exception:
Code:
System:
I'll try on my linux machine later. Could this be due to the OpenSSL version of the OS? (
LibreSSL 2.6.5
in this case). EDIT: Same thing on Manjaro.Any ideas?
Regards, James.