Skip to content

Login Kit

bbookman edited this page Aug 10, 2018 · 17 revisions

Login Kit

Login Kit lets your users authenticate with Snapchat and bring their existing identity into your app. It uses OAuth, with Snapchat as the identity provider.

Understanding Scopes

Scopes let your application declare which Login Kit features it wants access to. If a scope is toggleable, the user can deny access to one scope while agreeing to grant access to others.

Login Kit offers the following scopes:

iOS

Login Kit iOS gives you access to two Snapchat features, login and identity. Logging in via Snapchat removes the obstacles of signup and login for new users. The display name and Bitmoji avatar give users a familiar identity within your app.

Requirements

  • Client ID from the developer portal (see below in DIY section)

  • iOS version 10.0+

Getting started

In your app project in Xcode, add SCSDKCoreKit.framework and SCSDKLoginKit.framework into General > Embedded Binaries.

Add the following fields in your application’s Info.plist file:

  • SCSDKClientId (string): Your application’s client ID (see below in DIY section)
  • SCSDKRedirectUrl (string): The URL that will handle and complete login requests; must be a valid URL in the form foo://bar — without bar, redirects will fail (see below in DIY section)
  • SCSDKScopes (string-array): The scopes of access your application will request from the user; see Understanding Scopes section above
  • LSApplicationQueriesSchemes (string-array): Must contain snapchat, bitmoji-sdk, and itms-apps
  • CFBundleURLSchemes (string-array): Must contain your redirect URL’s scheme — so if your redirect URL is my-app://abc/xy/z, this field would contain my-app

Note: In the Snap Kit developer portal, add the same URL you put in Info.plist to your app's Redirect URLs. Without this, you'll get an error when your app tries to open Snapchat for OAuth.

DIY INSERT START

SCSDKClientId

The SCSDKClientId is the Development App Info OATH CLIENT ID for development purposes, and the App Info OAUTH CLIENT ID for production

It's the one on the right in this screen grab

Dev portal

SCSDKRedirectUrl

The SCSDKRedirectUrl and the CFBundleURLSchemes are related, as well as the value to place in the Snapchat Developer Portal.

The values can be completely made up. As long as the values match and are unique (see below). For example, if my app is named This Crazy App I could set these values:

<key>CFBundleURLSchemes</key>
                <array>
                    <string>thiscrazyapp</string>
                </array>

And

<key>SCSDKRedirectUrl</key>
        <string>thiscrazyapp://myapp</string>

Then you would add thiscrazyapp://myapp to the Snapchat Developer Portal in the Redirect URLs section by clicking the Add button to the right

A note from a snapchat dev:

The redirect URL itself doesn't need to have any meaning associated with it - so in general, the only real criteria would be to pick a URL with a scheme that is unlikely to collide with a scheme of another app.

If your app already has a URL scheme that it uses, then you'd probably just want to reuse that. Otherwise, a URL scheme of yourfirstandlastname might work well for you. In your case then, you may want to use the redirect URL yourfirstandlastname://snap-kit/auth.

DIY INSERT END