Seventh Week in Coding Bootcamp: Authentication with OAuth

By: Karen Snyder

On November 2, I began the seventh week at Origin Coding Academy. Hard to believe the first half of coding bootcamp was over, and I was starting the second half! In the beginning of the week, I learned more about passing information to the different states of a single-page application, and also learned how to use the AngularJS $resource factory to simplify access to the PropertyManager API, resulting in much less code than I had needed in KnockoutJS to access an API. The $resource factory can be used only with RESTful APIs, and luckily the APIs that I write in this course are RESTful. After that I was able to complete the front end of the PropertyManager Web application, including showing all properties, tenants, and leases, along with the functionality to add and update each.

Then I started earning about authentication and authorization, which is a huge topic that can’t be completely learned in one week, but it is possible to get some understanding of the subject. I was assigned the tutorials here, written by Taiseer Joudeh, which illustrate how to authenticate users in a Web API and AngularJS front end with a token-based approach. The token-based approach means that the server assigns a token to a validated user. The client saves the token and sends it with each request that the user makes to read or write data. This approach helps the client to share the server load in authentication, and the token is more simple to store than cookies.

After going through the tutorials, the next project was to use the knowledge gained by adding authentication to the PropertyManager Web application. I had to modify the Web API to add authentication, based on what was taught in the tutorials, by using ASP.NET Identity and Owin middleware packages in order to register new users and validate user credentials to generate tokens.

I learned how to use the Chrome Postman extension to verify after making the changes that it was not possible to access the API without first registering as a user and then obtaining a token to send with the GET or PUT to the API.

Then after verifying the the back end authentication was working, I added authentication to the front end. I added a login and registration screen to the front end of the PropertyManager Web application, along with a logout button and a display of the logged-in user. When trying to log in with the front end, I initially ran into some problems with Cross-Origin Resource Sharing (CORS), as the default is that the API does not allow requests originating from a different domain. These problems did not occur when testing with Postman, as requests sent by Postman are not interpreted by the API as originating from a different domain, however requests from the front end are interpreted as being in a different domain. I made some changes in the API to allow CORS and was able to proceed with the front end changes.

I also learned more about how to validate in AngularJS by using components of theinput directive. Cameron explained to me that rather than disabling the submit button if a field is invalid, it is a better user experience to allow the user to complete their typing and click the button to submit, and only then to display any problems with the input data. I added validation logic to the login, register, and add property/tenant/lease screens, such that when the user submits the form, any required fields that have not been filled in are highlighted in red with a message underneath stating that they are required.

The guest speaker this week was Jim Milton from Portfolium, which is a site that allows you to build an online portfolio of projects. He explained the best ways to leverage our portfolios to make us more attractive to recruiters and prospective employers. Now I need to improve my portfolio according to his suggestions!

A Week Worth Smiling About!

By: Zak Dietzen

I ended up getting a slight cold and it really drained all of my energy this past weekend. Despite the small setback, this week has been awesome! I felt like I was completely lost last week working with Knockout, but now Zak is back! We learned about an alternative to KnockoutJS this week, and that alternative is AngularJS. Angular has been so awesome to work with and is very powerful. I found it much more structured and less chaotic than Knockout. I would love to never work with knockout again but I know that won’t make me a very good developer. So, I really would like to go back and study it more.

The projects we have worked on this have been the most fun to build yet. I am starting to get the hang of JavaScript more and html and css is getting pretty easy. Working with Angular we built a bChipotle Finder Screenshot1udget calculator, Chipotle Locator, an interactive resume, and an API! We will be taking the API we built and will be building the front end over the weekend. So, technically… I am a full stack developer!!  We also learned about an AMAZING package installer called Bower. It makes installing everything so easy. I highly recommend everyone check it out.

I am really glad we went back and created another API using Entity Framework this week and introduced AutoMapper. AutoMapper was really awesome to work with and made creating databases a lot easier. I felt like making the API this time was a lot easier than the first time we made one. All the extra tools we have learned since then have been game changers.

We had a MeetUp this week at Zeeto. There were a few lightning talks on JavaScript tools, Agile Development, and gave us a tour of their incredible office. You can learn more about what Zeeto does by clicking here. We also had 2 guest speakers this Friday. Clint Johnson, an IT technical recruiter at ManpowerGroup was our first speaker. Clint came in and talked about the job hunting process and what we should expect. He also gave great tips on resume building. Our second speaker was Bryan Hall. Bryan is the Co-founder and CTO at Email Copilot. His company works in the same space as Origin so it was awesome to get a chance to hear him talk and ask him questions. He gave us some solid advice on interviews and advice on what we should do as Jr. Devs to make us better and easier to work with. Having speakers come in every Friday has been so helpful.

It really does amaze me how far we have all come in 6 weeks. We are learning so many tools and they are getting sharper and sharper each time we use them. It is also unbelievable my time at Origin Code Academy is already halfway over. They say time flies when you are having fun, I can say with confidence that is true! I can not wait to see what the next 6 weeks brings.