Latest 0.0.3
Homepage https://github.com/flutter/google_sign_in
License BSD
Platforms ios 7.0
Dependencies Google/SignIn
Authors

A Flutter wrapper for Google Sign In.

Note: This is a work-in-progress, and is not fully supported by the Flutter team.
(For example, we don’t have this under continuous integration and testing.)

Building the example

You will need to register a new application in the Google Developer console to run the example in this repository.

iOS

Make sure you have CocoaPods installed and run pod install in the example/ios folder. You can now open example/ios/GoogleSignInExample.xcworkspace in Xcode. Go to the iOS Sign-In SDK instructions and follow the instructions to add a GoogleServices-Info.plist file to your project and to set up a URL type for REVERSED_CLIENT_ID to handle the callback.

Use flutter run to create the Generated.xcconfig file, build the example, and install it on the iOS simulator or device. You should be able to sign in successfully.

Adding to an existing project

iOS

Make sure you have CocoaPods installed and run pod init in your ios folder.
Edit your Podfile to add pod 'FlutterGoogleSignIn and run pod install.
You can now open example/ios/Runner.xcworkspace in Xcode.

Go to the iOS Sign-In SDK instructions and follow the instructions to add a GoogleServices-Info.plist file to your Runner project and to set up a URL type for REVERSED_CLIENT_ID to handle the callback.

Modify your AppDelegate.m to pass your view controller to the FLTGoogleSignIn shared instance and notify it when your application is opened with a URL:

#import <GoogleSignIn/FLTGoogleSignIn.h>

@implementation AppDelegate

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
    FlutterViewController *controller = (FlutterViewController*)self.window.rootViewController;
    [controller addAsyncMessageListener:[FLTGoogleSignIn sharedInstance]];
    [FLTGoogleSignIn sharedInstance].uiDelegate = controller;
    return YES;
}

- (BOOL)application:(UIApplication *)app
            openURL:(NSURL *)url
            options:(NSDictionary *)options {
    return [[FLTGoogleSignIn sharedInstance] handleURL:url
                                     sourceApplication:options[UIApplicationOpenURLOptionsSourceApplicationKey]
                                            annotation:options[UIApplicationOpenURLOptionsAnnotationKey]];
}

Compiling from source

If you want to make changes to the FlutterGoogleSignIn class, you’ll need to build from source rather than using the published binaries.
You’ll need a local checkout of the google_sign_in repository, which can be in any location.

iOS

Change the reference Podfile to pod 'FlutterGoogleSignIn', :path => '/path/to/google_sign_in' and run pod install.

You should now be able to build from source using Xcode or flutter run.

Issues and feedback

Please file issues
to send feedback or report a bug. Thank you!

Latest podspec

{
    "name": "FlutterGoogleSignIn",
    "version": "0.0.3",
    "summary": "Convenience wrapper for the Google/SignIn API in Flutter apps.",
    "description": "FlutterGoogleSignIn helps Flutter iOS apps use the Dart google_sign_in API to authenticate users.",
    "homepage": "https://github.com/flutter/google_sign_in",
    "license": {
        "type": "BSD",
        "file": "LICENSE"
    },
    "authors": {
        "Collin Jackson": "[email protected]"
    },
    "source": {
        "git": "https://github.com/flutter/google_sign_in.git",
        "tag": "0.0.3"
    },
    "social_media_url": "https://twitter.com/flutterio",
    "platforms": {
        "ios": "7.0"
    },
    "source_files": "ios/FlutterGoogleSignIn/Classes/**/*",
    "dependencies": {
        "Google/SignIn": [
            "~> 2.0.4"
        ]
    }
}

Pin It on Pinterest

Share This