| 02:00 | * | polo has joined |
| 02:09 | * | polo has quit (Quit: My MacBook has gone to sleep. ZZZzzz…) |
| 09:00 | * | RafatKhashan[m] has quit (Quit: You have been kicked for being idle) |
| 12:17 | mstenta[m] | @room farmOS 2.0.0-beta7 has been released! 🎉 github.com/farmOS/farmOS/releases/tag/2. |
| 13:38 | * | waves again - sunset here - good morning! |
| 13:39 | evered[m] | *sunrise |
| 13:39 | * | * waves again - sunrise here - good morning! |
| 15:10 | mstenta[m] | @room Weekly dev call in about 50 minutes: meet.jit.si/farmos-dev - All are welcome! |
| 15:20 | mstenta[m] | paul121: I wonder if we could try to test the simple_oauth 5.2 stuff again |
| 15:20 | mstenta[m] | I have it all set up locally (along with PHP8) so we can dive in if we want |
| 15:22 | evered[m] | testing is good - "trust but verify" |
| 15:31 | mstenta[m] | paul121: I'd also love to talk about `composer.lock` if we have some time :-) |
| 15:53 | paul121[m] | Both sound good |
| 15:54 | paul121[m] | I'm having post "upgraded my os" woes... |
| 15:56 | paul121[m] | Brave/chromium wont load some sites, and won't let me clear browsing data! Arg |
| 15:56 | symbioquine[m] | Time for Firefox! |
| 15:56 | mstenta[m] | womp womp |
| 15:56 | mstenta[m] | i'm gonna jump into the dev call early... nothing else to do 😄 |
| 17:02 | paul121[m] | symbioquine: re: github.com/farmOS/farmOS-map/issues/184 |
| 17:02 | paul121[m] | I wanted to ask your opinion about the "convenience" method. It might be able to add a convenience method before a larger refactor of using the interaction "active" state? |
| 17:03 | paul121[m] | Adding the convenience method would introduce the abstraction to however things are implemented, allowing the implementation to change |
| 17:04 | paul121[m] | But I still need to evaluate how important this even is for the use case I was working on, not sure yet |
| 20:17 | mstenta[m] | paul121: I am idly starting to run the oauth tests to see if I can get a sense of what's happening |
| 20:21 | FarmerEd[m] | Oath client is not included in this code by any chance is it? |
| 20:22 | mstenta[m] | Nothing has changed in 2.0.0-beta7 |
| 20:23 | mstenta[m] | We're working on upgrading the oauth module ahead of php8 support |
| 20:31 | FarmerEd[m] | I know that, |
| 20:31 | FarmerEd[m] | But I possibly need to include an oath client for some modules to authenticate with other software. |
| 20:31 | FarmerEd[m] | But then again could probably get away with just using the http client already included with Drupal. |
| 20:34 | FarmerEd[m] | I suppose the opposite of what you are working on. |
| 20:35 | mstenta[m] | Oooh you mean like what we were talking about with the USDA making a module for the USDA eAuth identity provider? |
| 20:35 | mstenta[m] | (Similar to something like "login with your google account") |
| 20:38 | FarmerEd[m] | No not that either, |
| 20:38 | FarmerEd[m] | I have some node red flows for synchronizing the Department of Agricultures herd database with farmOS but considering migrating to a module. So I'd need my farmOS instance to be the client which connects to the other server via Oauth2 |
| 20:38 | mstenta[m] | Oooh ok gotcha :-) |
| 20:38 | mstenta[m] | Yea you're kinda on your own with that. There isn't anything in farmOS that helps with that specifically. |
| 20:39 | mstenta[m] | But I know paul121 has done some things with similar integrations using OAuth so he might have some pointers |
| 20:39 | FarmerEd[m] | 👍 |
| 20:40 | FarmerEd[m] | Cool, I know more or less how it works, just making sure there wasn't anything included before reinventing the wheel |
| 20:42 | mstenta[m] | I mean... maybe there is something included that I'm not aware of! 😄 |
| 20:42 | FarmerEd[m] | Think there are a few Drupal client specific modules about too. |
| 20:42 | mstenta[m] | Guzzle at the very least (that's the PHP requests library basically... comparable to Python `requests` or JS `axios` as I understand it) |
| 20:43 | mstenta[m] | But there may be OAuth2 specific libraries on top of that that handle flows |
| 20:43 | mstenta[m] | I'm sure there are... just not sure if it's included in the farmOS code/dependencies |
| 20:44 | FarmerEd[m] | Yea, I've used Guzzle for a few modules already, and built the oauth2 flow I need in node red using http request nodes so can coble something together I'm sure one way or another. |
| 20:45 | mstenta[m] | oauth.net/code/php/ |
| 20:45 | mstenta[m] | I imagine this one is what you'd want: github.com/thephpleague/oauth2-client |
| 20:45 | mstenta[m] | Our oauth2 server module uses the opposite package from the same authors |
| 20:45 | mstenta[m] | (`oauth2-server` instead of `oauth2-client`) |
| 20:46 | mstenta[m] | > @paul121: I am idly starting to run the oauth tests to see if I can get a sense of what's happening |
| 20:46 | mstenta[m] | OK so... this response has a `401` status code (which I think we expected - just my first clue): github.com/farmOS/farmOS/blob/2.x/module |
| 20:48 | mstenta[m] | So that method return `NULL`... which means `$token_info['id']` is not set here: github.com/farmOS/farmOS/blob/8a2dd9474b |
| 20:48 | mstenta[m] | And that leads to the error we're seeing in the test results (`Undefined array key "id"`) |
| 20:48 | mstenta[m] | Now... we just need to figure out why the response is resulting in `401`! 😄 |
| 20:52 | paul121[m] | <mstenta[m]> "But I know paul121 has done some..." <- yep, I've built one OAuth integration but it's just a custom wrapper around the Guzzle client. I wanted to use an oauth-client PHP library but unfortunately their OAuth implementation wasn't 100% to sepc. I've found this is unfortunate & common reality :-/ |
| 20:53 | paul121[m] | mstenta[m]: yeah, I think at one point we were able to identify we were not getting a token at all |
| 20:53 | paul121[m] | which could mean many different things :-/ |
| 20:55 | mstenta[m] | Gonna try stepping into the post request... even though I have no idea what I'm looking at haha |
| 20:56 | mstenta[m] | (and will undoubtedly lead me through a labyrinth of methods...) |
| 20:58 | FarmerEd[m] | Is that module on git by any chance paul121: ? |
| 21:02 | paul121[m] | FarmerEd[m]: yes this farm_farmlab module (the one I wanted to demo!): github.com/paul121/farm_farmlab |
| 21:02 | paul121[m] | This uses the OAuth authorization flow. The client is here, has a couple OAuth helper functions, notably a helper to auto-refresh OAuth tokens which might be useful: github.com/paul121/farm_farmlab/blob/1.x |
| 21:03 | mstenta[m] | Oh that's neat paul121 - I like that it just extends `GuzzleClient` |
| 21:05 | paul121[m] | Another thing I have learned when creating these "client" classes/services is to create a "ClientFactory" service that injects the credentials/api token/etc separate from your actual client class. The drupal/symfony services have native support for this "factory": |
| 21:05 | paul121[m] | - github.com/paul121/farm_farmlab/blob/1.x |
| 21:05 | paul121[m] | - github.com/paul121/farm_farmlab/blob/1.x |
| 21:08 | FarmerEd[m] | Cool paul121: that might just be enough to get me started. |
| 21:09 | mstenta[m] | paul121: ah hmm... maybe a clue: `invalid_client` |
| 21:11 | mstenta[m] | Or maybe that's not helpful haha - it's interesting that that is the message we were seeing in the original test failures (www.drupal.org/project/farm/issues/32821) |
| 21:22 | paul121[m] | ah, that last message is irrelevant. I believe it is fixed with one of our last patches that got included with 5.2.x |
| 21:23 | mstenta[m] | > paul121: ah hmm... maybe a clue: `invalid_client` |
| 21:23 | mstenta[m] | this is what i got tracing through the debugger just now |
| 21:23 | mstenta[m] | will have a better idea shortly... waiting for the functional test to run again and my debugger to stop it :-) |
| 21:23 | mstenta[m] | brute force debugging |
| 21:26 | mstenta[m] | happened here: github.com/thephpleague/oauth2-server/bl |
| 21:26 | mstenta[m] | gonna figure out why next... |
| 21:31 | mstenta[m] | ok... |
| 21:33 | mstenta[m] | I'm in this method: git.drupalcode.org/project/simple_oauth/ |
| 21:33 | mstenta[m] | ... and it is returning `FALSE` |
| 21:37 | mstenta[m] | It's making it into the last check at the bottom (not sure if it should or not), but `$client_secret` is `null`, so it's returning `FALSE` before it can check `$this->passwordChecker->check($client_secret, $client_drupal_entity->get('secret')->value)` |
| 21:40 | mstenta[m] | I feel like maybe it shouldn't be getting that far? |
| 21:41 | paul121[m] | mstenta[m]: ah. so the consumer has a secret configured, but no `$client_secret` was provided, so it doesn't need to do a password check |
| 21:41 | mstenta[m] | ok... |
| 21:43 | mstenta[m] | so... trying to understand: which block of code do we want to be returning `TRUE` in this test? |
| 21:43 | mstenta[m] | that last block? or the one before it (which it skips over) |
| 21:44 | mstenta[m] | (line 71 or line 80?) git.drupalcode.org/project/simple_oauth/ |
| 21:44 | paul121[m] | I think those blocks align with the two cases: |
| 21:44 | paul121[m] | First block = the client does not have a `client_secret` |
| 21:44 | paul121[m] | Second block = the client does have a `client_secret` |
| 21:44 | mstenta[m] | ok that makes sense |
| 21:45 | paul121[m] | so it depends if in the test the client has a secret configured |
| 21:45 | mstenta[m] | looking... |
| 21:46 | mstenta[m] | ok so yea... we don't use `client_secret` in any of our tests (if i'm reading correctly) |
| 21:47 | mstenta[m] | oh wait... |
| 21:47 | paul121[m] | but do we inherit the client from their tests? |
| 21:47 | mstenta[m] | ah we doo! yes! |
| 21:47 | mstenta[m] | yes yes yes |
| 21:47 | mstenta[m] | got it |
| 21:48 | mstenta[m] | ah so maybe they started using `client_secret` in the upstream tests... and we need to update ours to send it... (just a guess... looking....) |
| 21:49 | mstenta[m] | that might be it... running another test... |
| 21:58 | mstenta[m] | to be continued... dinner time :-) |
| 23:58 | mstenta[m] | paul121: Alright! Got that test to pass! Now to see if it fixes the others too... 🤞 |