SPTSessionManager Class Reference
| Inherits from | NSObject |
|---|---|
| Declared in | SPTSessionManager.h |
session
The SPTSession for the SPTSessionManager to manage. If no user has been authenticated this will be nil
@property (nullable, nonatomic, strong) SPTSession *sessionDeclared In
SPTSessionManager.h
delegate
The SPTSessionManagerDelegate to notify of initiating a session, renewing a session, and/or errors related to a
session
@property (nullable, nonatomic, weak) id<SPTSessionManagerDelegate> delegateDeclared In
SPTSessionManager.h
spotifyAppInstalled
Determine if the Spotify app is installed.
@property (nonatomic, readonly, getter=isSpotifyAppInstalled) BOOL spotifyAppInstalledDiscussion
Will be YES if the Spotify app is installed (and the URL scheme is whitelisted), otherwise is NO.
Note: You must whitelist the “spotify” URL scheme in your info.plist LSApplicationQueriesSchemes or this will always be
NO
Declared In
SPTSessionManager.h
alwaysShowAuthorizationDialog
Set this value to YES when debugging to have the Spotify app always show the authorization confirmation screen.
You SHOULD NOT set this value to YES in production or your users will always have to confirm.
@property (nonatomic, assign) BOOL alwaysShowAuthorizationDialogDeclared In
SPTSessionManager.h
– initiateSessionWithScope:options:campaign:
Initiate the authorization process
- (void)initiateSessionWithScope:(SPTScope)scope options:(SPTAuthorizationOptions)options campaign:(nullable NSString *)campaignParameters
scope |
The scope to request, e.g. |
|---|---|
options |
Options bitmask that informs authorization behavior. |
campaign |
The campaign identifier, to help attribute where the account linking was initiated from.
See |
Declared In
SPTSessionManager.h
– initiateSessionWithRawScope:options:campaign:
Initiate the authorization process
- (void)initiateSessionWithRawScope:(NSString *)scope options:(SPTAuthorizationOptions)options campaign:(nullable NSString *)campaignParameters
scope |
The scope to request, e.g. |
|---|---|
options |
Options bitmask that informs authorization behavior. |
campaign |
The campaign identifier, to help attribute where the account linking was initiated from.
See |
Discussion
Note: Prefer initiateSessionWithScope:options:campaign instead, unless you need additional scopes that aren’t listed
in SPTScope
Declared In
SPTSessionManager.h
– renewSession
Attempt to renew the access token, using the refresh token in the current SPTSession which must be valid.
- (void)renewSessionDeclared In
SPTSessionManager.h
– initWithConfiguration:delegate:
Create an SPTSessionManager with the provided configuration.
- (instancetype)initWithConfiguration:(SPTConfiguration *)configuration delegate:(nullable id<SPTSessionManagerDelegate>)delegateParameters
configuration |
An |
|---|---|
delegate |
An optional delegate conforming to |
Return Value
An SPTSessionManager with the desired configuration.
Declared In
SPTSessionManager.h
– application:openURL:options:
Handle openURL callbacks from the AppDelegate
- (BOOL)application:(UIApplication *)application openURL:(NSURL *)URL options:(NSDictionary<UIApplicationOpenURLOptionsKey,id> *)optionsParameters
application |
The |
|---|---|
URL |
The URL to attempt to parse the access token from |
options |
The options passed in to the matching |
Return Value
Returns YES if SPTSessionManager recognizes the URL and will attempt to parse an access token, otherwise
returns NO.
Declared In
SPTSessionManager.h
– application:continueUserActivity:restorationHandler:
Handle continueUserActivity callbacks from the AppDelegate
- (BOOL)application:(UIApplication *)application continueUserActivity:(NSUserActivity *)userActivity restorationHandler:(void ( ^ ) ( NSArray<id<UIUserActivityRestoring> > *__nullable restorableObjects ))restorationHandlerParameters
application |
The |
|---|---|
userActivity |
An object encapsulating a user activity supported by this responder. |
restorationHandler |
A block to execute if your app creates objects to perform the task the user was performing |
Return Value
Returns YES if SPTSessionManager recognizes the URL and will attempt to parse an access token, otherwise
returns NO.
Declared In
SPTSessionManager.h