-
Notifications
You must be signed in to change notification settings - Fork 12
Home
Use IBM Cloud functions to create an OAuth app with Angular
This code pattern we demonstrate given a web app, how to utilize IBM Cloud functions with OAuth 2 to simplify the authentication and authorization.
Cloud
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.
Niklas Heidloff Andy Shi
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.
- User Login to Angular web app.
- The web app invokes IBM Cloud functions
- The IBM Cloud functions calls Google OAuth API
- Google OAuth API returns results to callback URL(the Angular web app)
- IBM Cloud functions: Execute code on demand in a highly scalable, serverless environment.
- Serverless: An event-action platform that allows you to execute code in response to an event.
- title: description