Skip to content
This repository was archived by the owner on Jul 22, 2024. It is now read-only.
andy shi edited this page Jan 16, 2018 · 9 revisions

Short Name

Use IBM Cloud functions to create an OAuth app with Angular

Short Description

This code pattern we demonstrate given a web app, how to utilize IBM Cloud functions with OAuth 2 to simplify the authentication and authorization.

Offering Type

Cloud

Introduction

Each web app needs authentication and authorization. This seems really redundant yet for so many years there is no reusable solution. OAuth definitely leaped a big step forward by introducing 3rd party authentication and authorization. Still, authentication and authorization takes up a lot of deployment packaging and hosting resource considering user only logs in once for a relatively long time. IBM Cloud functions, the Serverless computing solution is the perfect solution. It only kicks up when user actually logs in and goes away when not needed.

Author

Niklas Heidloff Andy Shi

Code

code

Demo

Video

Overview

In this code pattern, we have a web app written in Angular JS. The next thing we do is to set up the Google OAuth API so users can login to their google account via OAuth. Of course, in the web app, the code already exists to invoke the IBM Cloud functions. Still we need to define the actions via the IBM wsk cli. After we wire everything up, we can see how the Login process invokes the IBM Cloud functions action to fire the OAuth request to Google API and return the token to Angular web app.

Flow

architecture

  1. User Login to Angular web app.
  2. The web app invokes IBM Cloud functions
  3. The IBM Cloud functions calls Google OAuth API
  4. Google OAuth API returns results to callback URL(the Angular web app)

Included components

  • IBM Cloud functions: Execute code on demand in a highly scalable, serverless environment.

Featured technologies

  • Serverless: An event-action platform that allows you to execute code in response to an event.

Blog

Blog Title

Blog Author

Blog Content

Links

Clone this wiki locally