Skip to main content

Posts

Auth0: Authorization Flows

 Today I write this entry after a few late nights of personal research.  I am building an app and an important part of it will be to integrate it to other services using Zapier .  To do that, I need to make a REST-ful API layer with no login form, but instead to have an authorize routine which can take the user's credentials and to pass back an Access Token . Up until now, other services I have helped establish have either used the Universal Login method, or simply with my own custom Javascript wrapper using the SDK .  Neither of these solutions is going to fit my need.  I did understand that from all of the available methods it had to offer, OAuth was going to fit it in some way, but I did not quite understand how I would evade having to use a login UI element. I've now had more of a solid read over the Auth0 Authentication API documentation, and on the subject of Get Token , there are number of different types of login flows, the main key/value that determi...

Text Manipulation

Today I want to share with you a few powerful examples of what you can do with ES6 - and a little out of the box thinking, and how much it will allow you to quickly scale up in a clean fashion. Cleaning Strings This for me was one of those "a Ha!" moments where the answer was just staring you in the face.  I had to include it since you may typically you might think to use some elaborate library.  Take the scenario where you present the user with an input box that allows for rich text, but you want the cleanest way to only store non-unicode characters.  Try this simple one-line gem: myCleanString = "test-_aaa'#@".replace(/[^0-9a-zA-Z-_' ]/gi, ''); The regular expression in this statement effectively says that for any characters not in this group (0-9, a-z, A-Z and symbol's hyphen, underscore, single quote and space), replace them with an empty string.  Do this for the characters of your choosing. DB Inserts/Updates Here I like to use the power of...

Low Level Debugging

Here's a small tip which I found extremely useful when I came across this type of (loosely) documented crash.  The problem is, it is extremely difficult to know at what point it crashed as there is no stack trace as part of it.  Likely as well (as in my case), it was in a vendor component (composer, etc.) which was designed for a different version of PHP. Well, here's the answer.  This guide shows how to create a simple script to include in to your program, which will echo out a filename and line for each " tick " that PHP is processing.  The last one it gets to before it crashes -- bingo, you know what's causing the problem! Hope this helps!

Documenting Version Control

I had my mid-year review yesterday, and delighted to have good comments from my boss for my contributions to all of our current projects.  The main thing he highlighted to me is that I should communicate my changes a bit more - perhaps an email/slack message at the end of the day, or better yet - some form of change log .  Definitely a good piece of constructive criticism. So I woke up this morning ready to find a good method to keep this to my routine, and to be honest, I was fairly let down with the tools that were off the shelf.  A simple Google search revealed mainly just how different groups defined the term, and maybe a couple of templates here and there.  I thought, what is the best way to document changes as well as to link those entries to the respective files and where they were changed.  My target audience is only the small team that I work alongside. And then it hit me; up until then I had not used GitHub releases, as I was only ever the sole develop...

Requests with Node

This is going to be just a quick entry today, and when I was thinking of what to write about, it dawned on me just how much research I had gone in to in making different types of requests (https) in Node.  Took me a while to first have it so it was able to switch between a GET and a POST of JSON data, but then when I needed to make changes on how I would post Form data (including a file attachment) was another kettle of fish - steam rolled at every turn. So - let me help take you out of your misery.  Here is my base function and its required required libraries: An example of using this would go like follows. form = {      file: '@/tmp/path/to/filename.txt',      comment: '' }; request("POST","www.server.com","/",{},{'Custom-Header':'Custom-Value'},form) .then(res=>{ //console.log(res); //... }) .catch(err=>{console.log(`Request Error: ${err}`)}); This will send form data, including the filename you specified in to the ...

Life in Lockdown

I'm sure it will come as no surprise that the reason it has been so long since I have published a post is because all of our lives have been turned upside down during this current crisis.  My heart goes out to everyone doing it tough, as so many jobs - including people close to me have had their jobs be made redundant.  Fortunately in my position, things have only gotten busier. My day job is for a company in the field of wholesale distribution, and the when the virus has put us in lock-down, the Government called upon our company and other retailers to have a deliverable solution for essential items.  Proud to say that while our company has never pulled something like this before - we did so in only 8 days .  It only offered 4 item as packs of essentials, but we saw a great proof of concept. Just as quickly, has it now expanded to the full product line, with registration now open to all and not those just who are most at risk.  The solution we have applied is s...

A Loyalty Pass Journey

Today's post is going to serve as a bit of a journal, the pitfalls and triumphs I'm facing as I achieve a smooth user experience in the world of creating digital loyalty cards.  The main player I'm working with on this is with Airship (formally Urban Airship).  Their support has been fairly good, I personally had the most trouble in linking the template with Google Pay.  The best piece of advice I can give is, do not start creating the template until you have got the Merchant Centre all ready to go. This is all going rather well at the moment, including using the Adaptive Link APIs which provides a simple query string approach which will redirect the request to either the iOS or Android pass depending on their device.  Ultimately though I would like to eventually call the Google and Apple API's directly so this has been a side project. I'm starting with Google, and the main piece of documentation starts here . Straight away there is a missing, or at least mis...