CityofSantaMonica / mds-provider

Python tools for working with MDS Provider data
https://github.com/openmobilityfoundation/mobility-data-specification
MIT License
18 stars 20 forks source link

Add compat for Spin's Auth Pattern #74

Closed hunterowens closed 5 years ago

hunterowens commented 5 years ago

Would love your thoughts on how to best architect this, currently testing rn.

johnclary commented 5 years ago

IIRC this one was pretty straightforward following these docs. We're not bothering with the refresh token and just request a new token every time. Is that bad?

Probably not helpful, but here's where we do auth stuff in our code that actually gets mds data: https://github.com/cityofaustin/transportation-dockless-processing/blob/77965ad424d6382149c0fbdca8a4be0f4d788821/get_data.py#L197

johnclary commented 5 years ago

Ah I see y'all are mixing in classes for provider-specific auth. Cool. That's more transparent than what we're doing, which is putting the auth params in a secrets.py config. Because these are just flavors of oauth with slightly different payload params, our approach is less fuss handling the provider nuances, but it's also hidden because it's in a secret config.

johnclary commented 5 years ago

Maybe refactor OAuthClientCredentialsAuth to handle an arbitrary payload, and define the provider-specific auth payloads as mix ins?

hunterowens commented 5 years ago

yeah. I dunno. @thekaveman do you have strong feelings? I suspect John and I feel this pain point more with 8+ operators vs 4. Happy to architect and fix as needed.

thekaveman commented 5 years ago

@hunterowens I'm OK with an approach like this until we figure out a more permanent solution.

You sure this works though? I don't see where that mixin is.. mixed in?