The day starts with a cycle through the Wicklow mountains, which was great and completely energised me.
Then the washing machine packed up, which was not so great. Began the debugging process – cleared out the drainage pipe (finding a 1 cent coin that must have been responsible for a lot of noise the machine made) but the drum still refused to go round. Emptied the machine and put it on a full wash cycle to see if it could be coaxed back to life. Saw the drum begin to twitch, followed by a loud pop, and the house fuse blew. Not good. Time to call a professional!
On the software front, I’m digging into OAuth 2.0, as part of the path to understand web site and web service security; and hopefully building some re-usable site registration and security components that can be re-used in multiple projects. Yes, it is probably easier to use off-the-shelf components, but I want to understand how the nuts and bolts of it work, and so doing it from the ground up seems to be the best way to achieve this.
I’m finding the more I talk to people, the more the array of modern relevant technology to learn and understand grows. My ‘To Learn’ list is expanding at an alarming rate…
Small steps is what it’s all about, and I’ve spent the day feeling like a total novice getting to grips with OAuth2 and the Angular framework. For simplicity I decided to go with the Google OAuth log-in API first of all, and the on-line docs here https://developers.google.com/identity/sign-in/web/sign-in made it look disarmingly simple.
It’s never as easy as it looks, and whilst the sign-in fragment worked well on its own, as soon as it was embedded inside my Angular2 application the button stopped appearing.
Several hours of digging around later and trying lots of different approaches, I have a basic Angular2 log-in component working. My plan is to implement the log-in mechanism as an Angular2 component to manage the user interaction, and a service object behind it which takes the User object and uses this to authenticate with my application service. Once this is working and stable I will post the code for anyone who may be interested.
Things I have learned today:
– Connecting to Google’s OAuth log-in APIs
– The horrible javascript technique of using ‘let that = this;’ for referencing ‘this’ in callback functions; and how to avoid the need for this with lambda (=>) functions instead.
– The need to use ‘ChangeDetectorRef’ in Angular in order to ensure bound variables actually cause the dependent UI element to update.