<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Unable to Authorize Users with iOS SDK - NSCocoaErrorDomain Code=3840 in Spotify for Developers</title>
    <link>https://community.spotify.com/t5/Spotify-for-Developers/Unable-to-Authorize-Users-with-iOS-SDK-NSCocoaErrorDomain-Code/m-p/5368876#M4405</link>
    <description>&lt;P&gt;&lt;STRONG&gt;My Question or Issue&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;I am using one of the earliest version of the Spotify iOS SDK that doesn't use the app remote calls. Most recently, my app users are no longer able to be authorized. Once their session and token are expired and an attempt to renew the token fails, I create a SPTAuth instance and attempt to create a login URL to enable them to login with the following code.&lt;SPAN class=""&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;NSURL&lt;SPAN class=""&gt;&amp;nbsp;&lt;/SPAN&gt;*loginURL = [SPTAuth&lt;SPAN class=""&gt;&amp;nbsp;&lt;/SPAN&gt;loginURLForClientId:kClientId&lt;/P&gt;&lt;P&gt;&lt;SPAN class=""&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/SPAN&gt;withRedirectURL:[NSURL&lt;SPAN class=""&gt;&amp;nbsp;&lt;/SPAN&gt;URLWithString:kCallbackURL]&lt;SPAN class=""&gt; &amp;nbsp;&lt;/SPAN&gt;scopes:@[SPTAuthStreamingScope,&lt;SPAN class=""&gt;&amp;nbsp;&lt;/SPAN&gt;SPTAuthPlaylistModifyPrivateScope,&lt;SPAN class=""&gt;&amp;nbsp;&lt;/SPAN&gt;SPTAuthPlaylistModifyPublicScope,&lt;SPAN class=""&gt;&amp;nbsp;&lt;/SPAN&gt;SPTAuthUserLibraryReadScope,&lt;SPAN class=""&gt;&amp;nbsp;&lt;/SPAN&gt;SPTAuthUserLibraryModifyScope,&lt;SPAN class=""&gt;&amp;nbsp;&lt;/SPAN&gt;SPTAuthUserReadPrivateScope]&lt;/P&gt;&lt;P&gt;&lt;SPAN class=""&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/SPAN&gt;responseType:@"code"];&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Once making this call to create the loginURL, I receive a callback in my app delegate:&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;-(&lt;STRONG&gt;BOOL&lt;/STRONG&gt;)application:(UIApplication&lt;SPAN class=""&gt;&amp;nbsp;&lt;/SPAN&gt;*)application&lt;/P&gt;&lt;P&gt;&lt;SPAN class=""&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/SPAN&gt;openURL:(NSURL&lt;SPAN class=""&gt;&amp;nbsp;&lt;/SPAN&gt;*)url&lt;/P&gt;&lt;P&gt;&lt;SPAN class=""&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/SPAN&gt;options:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;I then process this callback by calling my token swap service on my server to get a logged in session with the following code:&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN class=""&gt;&amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/SPAN&gt;SPTAuth&lt;SPAN class=""&gt;&amp;nbsp;&lt;/SPAN&gt;*auth = [SPTAuth&lt;SPAN class=""&gt;&amp;nbsp;&lt;/SPAN&gt;defaultInstance];&lt;/P&gt;&lt;P&gt;&lt;SPAN class=""&gt;&amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/SPAN&gt;auth.tokenSwapURL&lt;SPAN class=""&gt;&amp;nbsp;&lt;/SPAN&gt;= [NSURL&lt;SPAN class=""&gt;&amp;nbsp;&lt;/SPAN&gt;URLWithString:kTokenSwapURL];&lt;/P&gt;&lt;P&gt;&lt;SPAN class=""&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&lt;/SPAN&gt;[auth&lt;SPAN class=""&gt;&amp;nbsp;&lt;/SPAN&gt;handleAuthCallbackWithTriggeredAuthURL:url&amp;nbsp;callback:^(NSError&lt;SPAN class=""&gt;&amp;nbsp;&lt;/SPAN&gt;*error,&lt;SPAN class=""&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;SPTSession&lt;SPAN class=""&gt;&amp;nbsp;&lt;/SPAN&gt;*session) {&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;if (error) {&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; NSLog(@"Error:&lt;SPAN class=""&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;A&gt;%@",&lt;/A&gt;&amp;nbsp;error);&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;}&lt;/P&gt;&lt;P&gt;}&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;I receive an error as follows:&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Error Domain=NSCocoaErrorDomain Code=3840 "JSON text did not start with array or object and option to allow fragments not set. around line 2, column 1." UserInfo={NSDebugDescription=JSON text did not start with array or object and option to allow fragments not set. around line 2, column 1., NSJSONSerializationErrorIndex=2}&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;What does this error mean?&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;What might be causing this to suddenly fail? No change has occurred on my end in over a year, yet I and my users are suddenly failing to be authorized.&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Sat, 16 Apr 2022 22:14:02 GMT</pubDate>
    <dc:creator>jeffb6</dc:creator>
    <dc:date>2022-04-16T22:14:02Z</dc:date>
    <item>
      <title>Unable to Authorize Users with iOS SDK - NSCocoaErrorDomain Code=3840</title>
      <link>https://community.spotify.com/t5/Spotify-for-Developers/Unable-to-Authorize-Users-with-iOS-SDK-NSCocoaErrorDomain-Code/m-p/5368876#M4405</link>
      <description>&lt;P&gt;&lt;STRONG&gt;My Question or Issue&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;I am using one of the earliest version of the Spotify iOS SDK that doesn't use the app remote calls. Most recently, my app users are no longer able to be authorized. Once their session and token are expired and an attempt to renew the token fails, I create a SPTAuth instance and attempt to create a login URL to enable them to login with the following code.&lt;SPAN class=""&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;NSURL&lt;SPAN class=""&gt;&amp;nbsp;&lt;/SPAN&gt;*loginURL = [SPTAuth&lt;SPAN class=""&gt;&amp;nbsp;&lt;/SPAN&gt;loginURLForClientId:kClientId&lt;/P&gt;&lt;P&gt;&lt;SPAN class=""&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/SPAN&gt;withRedirectURL:[NSURL&lt;SPAN class=""&gt;&amp;nbsp;&lt;/SPAN&gt;URLWithString:kCallbackURL]&lt;SPAN class=""&gt; &amp;nbsp;&lt;/SPAN&gt;scopes:@[SPTAuthStreamingScope,&lt;SPAN class=""&gt;&amp;nbsp;&lt;/SPAN&gt;SPTAuthPlaylistModifyPrivateScope,&lt;SPAN class=""&gt;&amp;nbsp;&lt;/SPAN&gt;SPTAuthPlaylistModifyPublicScope,&lt;SPAN class=""&gt;&amp;nbsp;&lt;/SPAN&gt;SPTAuthUserLibraryReadScope,&lt;SPAN class=""&gt;&amp;nbsp;&lt;/SPAN&gt;SPTAuthUserLibraryModifyScope,&lt;SPAN class=""&gt;&amp;nbsp;&lt;/SPAN&gt;SPTAuthUserReadPrivateScope]&lt;/P&gt;&lt;P&gt;&lt;SPAN class=""&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/SPAN&gt;responseType:@"code"];&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Once making this call to create the loginURL, I receive a callback in my app delegate:&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;-(&lt;STRONG&gt;BOOL&lt;/STRONG&gt;)application:(UIApplication&lt;SPAN class=""&gt;&amp;nbsp;&lt;/SPAN&gt;*)application&lt;/P&gt;&lt;P&gt;&lt;SPAN class=""&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/SPAN&gt;openURL:(NSURL&lt;SPAN class=""&gt;&amp;nbsp;&lt;/SPAN&gt;*)url&lt;/P&gt;&lt;P&gt;&lt;SPAN class=""&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/SPAN&gt;options:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;I then process this callback by calling my token swap service on my server to get a logged in session with the following code:&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN class=""&gt;&amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/SPAN&gt;SPTAuth&lt;SPAN class=""&gt;&amp;nbsp;&lt;/SPAN&gt;*auth = [SPTAuth&lt;SPAN class=""&gt;&amp;nbsp;&lt;/SPAN&gt;defaultInstance];&lt;/P&gt;&lt;P&gt;&lt;SPAN class=""&gt;&amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/SPAN&gt;auth.tokenSwapURL&lt;SPAN class=""&gt;&amp;nbsp;&lt;/SPAN&gt;= [NSURL&lt;SPAN class=""&gt;&amp;nbsp;&lt;/SPAN&gt;URLWithString:kTokenSwapURL];&lt;/P&gt;&lt;P&gt;&lt;SPAN class=""&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&lt;/SPAN&gt;[auth&lt;SPAN class=""&gt;&amp;nbsp;&lt;/SPAN&gt;handleAuthCallbackWithTriggeredAuthURL:url&amp;nbsp;callback:^(NSError&lt;SPAN class=""&gt;&amp;nbsp;&lt;/SPAN&gt;*error,&lt;SPAN class=""&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;SPTSession&lt;SPAN class=""&gt;&amp;nbsp;&lt;/SPAN&gt;*session) {&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;if (error) {&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; NSLog(@"Error:&lt;SPAN class=""&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;A&gt;%@",&lt;/A&gt;&amp;nbsp;error);&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;}&lt;/P&gt;&lt;P&gt;}&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;I receive an error as follows:&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Error Domain=NSCocoaErrorDomain Code=3840 "JSON text did not start with array or object and option to allow fragments not set. around line 2, column 1." UserInfo={NSDebugDescription=JSON text did not start with array or object and option to allow fragments not set. around line 2, column 1., NSJSONSerializationErrorIndex=2}&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;What does this error mean?&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;What might be causing this to suddenly fail? No change has occurred on my end in over a year, yet I and my users are suddenly failing to be authorized.&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 16 Apr 2022 22:14:02 GMT</pubDate>
      <guid>https://community.spotify.com/t5/Spotify-for-Developers/Unable-to-Authorize-Users-with-iOS-SDK-NSCocoaErrorDomain-Code/m-p/5368876#M4405</guid>
      <dc:creator>jeffb6</dc:creator>
      <dc:date>2022-04-16T22:14:02Z</dc:date>
    </item>
  </channel>
</rss>

