-
public interface SnapLogin
Public API interface for the Login Kit.
-
-
Method Summary
Modifier and Type Method Description abstract String
getVersion()
Returns the version of the Login Kit. abstract View
getButton(@NonNull() ViewGroup container)
Method to get a standard "login" button to authenticate using Snapchat. abstract View
getButton(@NonNull() ViewGroup container, @NonNull() LoginFeatureOptions options)
Method to get a standard "login" button to authenticate using Snapchat. abstract void
startTokenGrant(@NonNull() LoginResultCallback callback)
The first step of the OAuth Flow to authenticate with Snapchat. abstract void
startTokenGrant(@NonNull() LoginResultCallback callback, @NonNull() LoginFeatureOptions options)
The first step of the OAuth Flow to authenticate with Snapchat. abstract void
addLoginStateCallback(@NonNull() LoginStateCallback callback)
Method to add a callback to receive updates to the user's login status. abstract void
removeLoginStateCallback(@NonNull() LoginStateCallback callback)
Method to remove the callback to stop receiving updates to the user's login status. abstract void
fetchAccessToken(@NonNull() AccessTokenResultCallback callback)
Fetches the access token for the current user. abstract void
clearToken()
Clears the local access token and refresh token, if it exists. abstract boolean
isUserLoggedIn()
Getter to know if the user is authenticated using Snapchat and has a valid auth token. abstract void
fetchUserData(@NonNull() UserDataQuery query, @NonNull() UserDataResultCallback callback)
Fetches the user data based on scopes requested. abstract void
startFirebaseTokenGrant(@NonNull() FirebaseCustomTokenResultCallback callback)
The first step of the OAuth Flow to authenticate with Firebase usingCustom Authentication System.
-
-
-
Method Detail
-
getVersion
@NonNull() abstract String getVersion()
Returns the version of the Login Kit.
-
getButton
@NonNull() abstract View getButton(@NonNull() ViewGroup container)
Method to get a standard "login" button to authenticate using Snapchat. (Optional)Alternatively, you can use startTokenGrant ()} directly to start authenticating.
- Parameters:
container
- The root container to inflate and attach the login button to.
-
getButton
@NonNull() abstract View getButton(@NonNull() ViewGroup container, @NonNull() LoginFeatureOptions options)
Method to get a standard "login" button to authenticate using Snapchat. (Optional)Alternatively, you can use startTokenGrant directlyto start authenticating.
- Parameters:
container
- The root container to inflate and attach the login button to.options
- The flags to be included in the Snapchat login request(triggered when the returned button is pressed).
-
startTokenGrant
abstract void startTokenGrant(@NonNull() LoginResultCallback callback)
The first step of the OAuth Flow to authenticate with Snapchat.
- Parameters:
callback
- The listener callback to receive the login result updates.
-
startTokenGrant
abstract void startTokenGrant(@NonNull() LoginResultCallback callback, @NonNull() LoginFeatureOptions options)
The first step of the OAuth Flow to authenticate with Snapchat.
- Parameters:
callback
- The listener callback to receive the login result updates.options
- The flags to be included in the Snapchat login request.
-
addLoginStateCallback
abstract void addLoginStateCallback(@NonNull() LoginStateCallback callback)
Method to add a callback to receive updates to the user's login status.
- Parameters:
callback
- The listener callback to receive the login state updates.
-
removeLoginStateCallback
abstract void removeLoginStateCallback(@NonNull() LoginStateCallback callback)
Method to remove the callback to stop receiving updates to the user's login status.
- Parameters:
callback
- The listener callback currently receiving the login state updates.
-
fetchAccessToken
abstract void fetchAccessToken(@NonNull() AccessTokenResultCallback callback)
Fetches the access token for the current user.
- Parameters:
callback
- The callback for the resulting access token or error message.
-
clearToken
abstract void clearToken()
Clears the local access token and refresh token, if it exists.If the token exists, and is cleared locally, then the user will be logged out and notified accordingly viathe onLogout callback.
-
isUserLoggedIn
abstract boolean isUserLoggedIn()
Getter to know if the user is authenticated using Snapchat and has a valid auth token.
-
fetchUserData
abstract void fetchUserData(@NonNull() UserDataQuery query, @NonNull() UserDataResultCallback callback)
Fetches the user data based on scopes requested.
- Parameters:
query
- The query to make.callback
- The listener callback to receive the user data updates.
-
startFirebaseTokenGrant
abstract void startFirebaseTokenGrant(@NonNull() FirebaseCustomTokenResultCallback callback)
The first step of the OAuth Flow to authenticate with Firebase usingCustom Authentication System.
- Parameters:
callback
- The listener callback to receive the custom token updates.
-
-