Skip to content

Instantly share code, notes, and snippets.

View mobilequickie's full-sized avatar

Mobile Quickie mobilequickie

View GitHub Profile
@mobilequickie
mobilequickie / LWAViewController-Federated.swift
Last active August 6, 2020 07:44
This is working ViewController that authenticates with Login with Amazon and uses the LoginWithAmazonProxy gist code.
//
// ViewController.swift
// AuthLWA with AWSMobileClient using Federated Identities
//
// Created by Hills, Dennis on 4/26/19.
// Copyright © 2019 Hills, Dennis. All rights reserved.
//
// Requires LoginWithAmazonProxy via Gist here: https://gist.github.com/mobilequickie/56916503a41ebb2374fea241ede26eab
// This gist: https://gist.github.com/mobilequickie/47a238e073043a271425f7ffe9d56d5e
//
platform :ios, '11.0'
target 'AuthLWA' do
# Comment the next line if you're not using Swift and don't want to use dynamic frameworks
use_frameworks!
# Pods for Auth
pod 'AWSMobileClient', '~> 2.9.0'
end
@mobilequickie
mobilequickie / AppDelegateLWASnippet.swift
Created November 1, 2018 23:05
The open url function for AppDelegate to handle callback from Login with Amazon flow
func application(_ application: UIApplication, open url: URL, options: [UIApplication.OpenURLOptionsKey : Any] = [:]) -> Bool {
return AIMobileLib.handleOpen(url, sourceApplication: UIApplication.OpenURLOptionsKey.sourceApplication.rawValue)
}
@mobilequickie
mobilequickie / LoginWithAmazonProxy.swift
Last active April 26, 2019 05:50
Login with Amazon proxy for iOS Swift app
// LoginWithAmazonProxy.swift
//
// Created by Hills, Dennis on 4/26/19.
// Copyright © 2019 Hills, Dennis. All rights reserved.
//
// Original credit to SUPERDASHENG at https://superdasheng.wordpress.com/author/superdasheng/
// Added logout, getAccessToken, and getUserProfile
// https://gist.github.com/mobilequickie/56916503a41ebb2374fea241ede26eab
import Foundation
@mobilequickie
mobilequickie / LWAViewController.swift
Last active April 26, 2019 06:07
Login with Amazon - View controller for handling login/logout for LWA
//
// ViewController.swift
// AuthLWA
//
// Created by Hills, Dennis on 4/26/19.
// Copyright © 2019 Hills, Dennis. All rights reserved.
//
// Requires LoginWithAmazonProxy.swift from here: https://gist.github.com/mobilequickie/56916503a41ebb2374fea241ede26eab
// Gist: https://gist.github.com/mobilequickie/346caccc2a07f18e2bea4fdf6fe8fd3f
//
@mobilequickie
mobilequickie / Plist-Google.xml
Created October 16, 2018 01:12
This is the Google Sign-In custom URL scheme for iOS in the Info.plist
<key>CFBundleURLTypes</key>
<array>
<dict>
<key>CFBundleURLSchemes</key>
<array>
<string>com.googleusercontent.apps.###########-xxxxxxxxxxxxxxxxxxxxxxxxxxxx</string>
</array>
</dict>
</array>
@mobilequickie
mobilequickie / Podfile-google
Last active October 16, 2018 00:42
Podfile for basic auth via Cognito User Pools and Google Sign-In for the AWS Mobile SDK for iOS
# Uncomment the next line to define a global platform for your project
# platform :ios, '11.0'
target 'GoogleAuth' do
# Comment the next line if you're not using Swift and don't want to use dynamic frameworks
use_frameworks!
# Pods for BasicandGoogleSignIn
pod 'AWSMobileClient'
@mobilequickie
mobilequickie / Podfile
Created October 11, 2018 16:26
Podfile for basic auth via Cognito User Pools and Facebook Login for the AWS Mobile SDK for iOS
# Uncomment the next line to define a global platform for your project
# platform :ios, '11.0'
target '<YOURPOJECTNAMEHERE>' do
# Comment the next line if you're not using Swift and don't want to use dynamic frameworks
use_frameworks!
# Pods for BasicandFBAuth
pod 'AWSMobileClient'
pod 'AWSFacebookSignIn'
@mobilequickie
mobilequickie / AWSMobileClient-AppDelegate.swift
Created October 11, 2018 16:23
This is a sample AppDelegate with the required three code snippets for adding AWSMobileClient to your project as a credentials manager
import UIKit
import AWSMobileClient //#1
@UIApplicationMain
class AppDelegate: UIResponder, UIApplicationDelegate {
var window: UIWindow?
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
@mobilequickie
mobilequickie / AuthUIViewController.swift
Created October 11, 2018 16:17
AWS Mobile SDK AuthUI code snippet for main ViewController. This is the same for User Pools, Facebook, and Google sign-in.
import UIKit
import AWSAuthCore
import AWSAuthUI
class ViewController: UIViewController {
override func viewDidLoad() {
super.viewDidLoad()
showSignIn()