【发布时间】:2020-06-18 14:37:12
【问题描述】:
我需要在使用 Spotify api 的 Flutter 应用中对用户进行身份验证。 我使用 flutter_web_auth 打开 WebView 并让用户在那里登录。 我无法让它返回应用程序。
在 Spotify 仪表板中,我将回调 Uri 设置为:https://spotifydata.com/callback
final callbackUrl = "https://spotifydata.com/callback";
void _authenticateSpotfy() async {
final url = Uri.https('accounts.spotify.com', '/authorize', {
'response_type': 'code',
'client_id': clientID,
'redirect_uri': 'https://spotifydata.com/callback:/',
'scope': 'user-read-private user-read-email',
});
final result = await FlutterWebAuth.authenticate(
url: url.toString(), callbackUrlScheme: callbackUrl);
}
AndroidManifest.xml
<activity android:name="com.linusu.flutter_web_auth.CallbackActivity" >
<intent-filter android:label="flutter_web_auth">
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
<data android:scheme="https://spotifydata.com/callback" />
</intent-filter>
</activity>
我在 Stack 上尝试过其他答案,但它们似乎不起作用。
【问题讨论】:
-
这个冒号有什么问题吗?
'https://spotifydata.com/callback:/' <- : -
是否能够找到任何解决方案?我有同样的问题,但找不到任何东西
-
大哥,
spotify_sdk设置成功了吗?