Over a million developers have joined DZone.

OAuth 2 Plugin to Simplify Mobile Development in Appery.io

· Java Zone

Microservices! They are everywhere, or at least, the term is. When should you use a microservice architecture? What factors should be considered when making that decision? Do the benefits outweigh the costs? Why is everyone so excited about them, anyway?  Brought to you in partnership with IBM.

OAuth 2.0 protocol is now the most popular authentication protocol for apps. By using OAuth protocol, you can securely authenticate with a variety of popular services what will increase app functionality and cover a much larger target audience.

The Appery.io App Builder has a large number of useful and convenient mobile development tools for rapidly creating Android, iOS and Windows Phone apps. Today we are glad to present another feature that significantly helps with the OAuth 2.0 authentication routine – the OAuth 2 Template plugin.

A new plugin is a set of parameters, services, JavaScript code and logic that matches the OAuth 2.0 flow. All you need to do is configure this plugin for your needs by adding certain API keys and URLs. We tried to simplify the OAuth setup in your mobile app as much as possible: making difficult things easy – that’s the main benefit of Appery.io.

Here is the basic flow implemented in this plugin:

  1. Once the app is launched, there is a “Sign in” button on the Home page. There is also JavaScript code that initiates the OAuth flow attached to the “Sign in” button.
  2. Once the “Sign in” button is clicked, the app will navigate to the defined (in OAuth_Settings) OAuth provider.
  3. Here, the user should sign in (if not signed in yet) and grant access to the app that requests permissions.
  4. Once the access in granted, the app will navigate back to the Details page and with the access_token parameter added to the URL.
  5. The next request will get the signed in user profile details. This means that any API call can be made with the obtained access token.

These five steps will be processed in the background, so all the user needs to do is click “Sign in” and grant an access to your app.

We prepared a step-by-step tutorial that shows how to add this plugin to your app and how to configure it with examples using Google authentication.

We tried to make this plugin as generic as possible that will work with as many OAuth 2 providers as possible. But, there is always a chance that OAuth flow and setup might be slightly different among various provides. It’s still important you read their docs and understand how their particular flow works.

Here at Appery.io, we always try to create the best solutions and simplify app development, so your feedback is extremely important to us – it’s how we gather information about how we can improve and update the builder in the future. Share your thoughts with us here, via email or on the forum and follow us on Twitter.

Discover how the Watson team is further developing SDKs in Java, Node.js, Python, iOS, and Android to access these services and make programming easy. Brought to you in partnership with IBM.

Topics:

Published at DZone with permission of Max Katz, DZone MVB. See the original article here.

Opinions expressed by DZone contributors are their own.

The best of DZone straight to your inbox.

SEE AN EXAMPLE
Please provide a valid email address.

Thanks for subscribing!

Awesome! Check your inbox to verify your email so you can start receiving the latest in tech news and resources.
Subscribe

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}