This is going to describe how to do Proof Key for Code Exchange (PKCE) with Go's golang.org/x/oauth2. A Brief Overview of PKCE PKCE is meant to be an extra layer of client authentication during the authorization code grant flow with public oauth clients (native apps, single page JS apps -- basically anything that cant' kep… Continue reading OAuth PKCE with Go
Using Structs in Custom Terraform Provider Data Sources
At PMG we maintain a custom terraform provider that talks to a few of our internal, platform APIs. APIs can change and evolve, and without a layer in between the API responses and terraform data sourcess, a custom TF provider can break when the API changes. I know this because I naïvely did this exact… Continue reading Using Structs in Custom Terraform Provider Data Sources
Give Modals, Drawers, and other Overlay Elements URLs with React Router
One of my pet peeves about webapps is that actions that happen in things like a modal or other popover are often not linkable. This makes sharing those actions with others hard: send a link to the original URL along with instructions about what to do in order to trigger the overlay. A much better… Continue reading Give Modals, Drawers, and other Overlay Elements URLs with React Router
How to Paginate Query & Scan Results with the DynamoDB PHP Client
This bit of AWS Docs has all the info you could possible need on DynamoDB pagination, but it's wordy. So here's a quick summary and code sample for PHP. DynamoDB respects a Limit argument in both Scan and Query, but it will also stop if the retrieved items exceed one megabyte regarldess of Limit. If… Continue reading How to Paginate Query & Scan Results with the DynamoDB PHP Client
The Lowest Value Stage of Software: Getting Early Feedback
In High Output Management, Andrew Grove mentions the term lowest value stage quite a bit. It's a term from the manufacturing world: manufacturing adds value to things by taking raw materials and turning them into something else that can be sold. The lowest value stage is where you want to catch issues. Problem with a… Continue reading The Lowest Value Stage of Software: Getting Early Feedback
PostgreSQL’s ROW_TO_JSON and JSON_AGG with JSON Columns
I've hit this a few times and had to remind myself how Postgres behaves when aggregating JSON columns or including them in ROW_TO_JSON. The short answer is that Postgres does the right thing. When a JSON column is included in ROW_TO_JSON or JSON_AGG the resulting values are not nested, encoded JSON. Here's our sample table… Continue reading PostgreSQL’s ROW_TO_JSON and JSON_AGG with JSON Columns
How to Require One Symfony Form Field and/or Another
Say there's a Symfony form that requires either one field to be submitted or another field. In this case, it's okay if both are submitted, but at least one is required. I had this exact situation come up earlier this week and all the solutions I found were related to adding validation to models. I… Continue reading How to Require One Symfony Form Field and/or Another
When to Return a 401 vs 403 HTTP Response
There are two side of the security coin: authentication and authorization. Authentication answers the question of who (a principal) is making the request to a given endpoint. Authorization is what determines if the principal is actually is allowed to do what they are trying to do. If authentication fails, a 401 Unauthorized response should be… Continue reading When to Return a 401 vs 403 HTTP Response
Design Data First
One thing I do pretty consistently when adding something to a web application is design the entity objects first, along with any associated value objects, without really thinking (or caring) about how those entities will be persisted or retrieved. For example, I recently had to design and build an audit log system for a project… Continue reading Design Data First
What Dependencies Should be Injected into a Controller?
This article ist mostly about Symfony, but the advice here applies across frameworks. It's easier to define what's shouldn't be injected as a dependency: things global to the framework or the application being built. A form system is something global to the framework/application. Should the FormFactory be injected into every controller? How about templating? Should… Continue reading What Dependencies Should be Injected into a Controller?