About the Download

Ti.OAuth

This HyperLoop module allows you to use the awesome OAuth.IO SDK for iOS.
sep-16-2016-12-03-52

1 – Requirements

This project uses HyperLoop. We recommend you to read the basics of HyperLoop in the links below before proceeding any further in this README.
iOS: https://s3-us-west-2.amazonaws.com/appc-labs-server/downloads/Hyperloop+for+iOS+Programming+Guide.pdf
Android: https://s3-us-west-2.amazonaws.com/appc-labs-server/downloads/Hyperloop+for+Android+Programming+Guide.pdf

HyperLoop does a pretty good job in allowing you to use Objective-C / Swift with Javascript syntax, but that doesn’t mean that you won’t need to learn Objective-C / Swift if you want to customize the module / create your own. For that reason we highly recommend you to learn the basics of Objective-C / Swift.

2 – Check your environment setup

This module was tested and developed with the following environment:

  • Titanium SDK 5.5.0.GA
  • HyperLoop 1.2.7
  • XCode 7.3.1
  • CocoaPods 1.0.1

Make sure to have the same environment otherwise you may come across errors.

3 – Creating a HyperLoop-enabled project and configuring your OAuth.IO account.

Creating an account at OAuth.IO and configuring your OAuth providers can consume a little bit of time. Currently you can use many OAuth providers, but in this document we’ll be covering only how to use Google’s OAuth.

  • First of all, head to https://oauth.io/signin and create an account in case you still don’t have one.
  • After logging in you’ll see your dashboard. In the left side of the page, above the menu, you’ll see a button where it says “Default app”. You’ll need to click on that button and then click “New App”.
  •  A small dialog will show up asking you the name of your new project and the whitelisted domains (a list of domains from which you wish to authorize the use of this app’s keys). Fill in the required fields and proceed to create your project.
  • Again on the left menu, click on “Integrated APIs”. In this new screen you’ll be able to manage the OAuth APIs that you want to use with your app.
  • Click on “Add APIs”.
  • In the next list that shows up click on Google. You’ll be asked for a few details of your Google
    project (if you don’t have one this same page has a link to the official Google documentation with plenty of tutorials on how to create an client app – we can’t cover the subject in this README because Google has already done it 🙂 ).
  • Fill all the required fields (client_id, client_secret and scope) with the values available in your Google Project and click “Try Auth”.
  • If you followed all the steps correctly you should see a Google popup requesting you to give permission to OAuth.IO. If you successfully log in with your account you’ll be able to see your account information printed to the console.

Again: this module only covers the major feature of the OAuth.io SDK. We highly recommend you to look at their documentation and explore the rest of the functionalities provided by this amazing SDK.

  • Now you’re ready to start using Google’s OAuth API with the OAuth.IO SDK!
  • Create a new Alloy project like you would normally do
  • Remember to change the <guid> in the provided tiapp.xml to a valid one (you can find that in one of your projects).
  • Copy the provided Podfile to your app’s root folder. Now open it and change where it says “CHANGE THIS” with your project’s name. Your project’s name is defined inside your tiapp.xml with the tag <name>.
  • Merge all the files contained in the provided “app” folder to your project’s corresponding “app” folder.
  • Run the project and say goodbye to OAuth complications 🙂

4 – Support

One of the things we want to offer you as a reward for joining LoopModules is the ability to contact us to discuss and get help with problems that you may come across.
We’ve tested this module a lot of times and we want to deliver something that will work for everyone (as long as the environments are the same, e.g. SDK, HL version, and so on).
If you come across one of the following…

  • Bugs
  • Suggestions
  • Issues while compiling this module

… feel free to contact us at contact@loopmodules.com.