Ionic 3中无与伦比的深层链接

Jam*_*son 5 deep-linking ionic-framework ionic3

我的应用程序流程如下所示:

  1. 启动应用
  2. 在浏览器(Chrome)中打开Spotify的“允许访问应用程序”页面,
  3. 用户授予应用权限,并重定向到https://appurl.com/spotify-callback/
  4. 该网址是深层链接,因此我的应用现在可以再次打开,
  5. 现在,深层链接插件应该匹配/spotify-callback/并打开名为SpotifyCallbackPage的页面,但是我得到了错误console.error: Got a deeplink that didn't match

我的深层链接代码如下:

deeplinks.route({
                '/spotify-callback/': SpotifyCallbackPage
            }).subscribe((match) => {
                // match.$route - the route we matched, which is the matched entry from the arguments to route()
                // match.$args - the args passed in the link
                // match.$link - the full link data
                console.log('Successfully matched route', match);
            }, (nomatch) => {
                // nomatch.$link - the full link data
                console.error('Got a deeplink that didn\'t match');
                console.log(nomatch);
            });
Run Code Online (Sandbox Code Playgroud)

发送到路由器的URL是:

https://appurl.com/spotify-callback/#access_token=random-access-token-here&token_type=Bearer&expires_in=3600
Run Code Online (Sandbox Code Playgroud)

完整的错误消息是:

error opening ws message: {"category":"console","type":"log","data":["On deep 
            link",{"url":"https://appurl.com/spotify-callback/#access_token=random-access-token-here&token_type=Bearer&expires_in=3600","path":"/spotify-callback/","scheme":"https","host":"appurl.com","fragment":"access_token=random-access-token-here&token_type=Bearer&expires_in=3600","extra":{"org.chromium.chrome.browser.eenp":["io.ionic.starter"],"org.chromium.chrome.browser.referrer_id":21,"com.android.browser.application_id":"com.android.chrome"}}]}
[16:28:02]  console.error: Got a deeplink that didn't match 
Run Code Online (Sandbox Code Playgroud)

我在路由器中尝试了不同的URL和端点,但是没有一个可以匹配。有人知道我应该尝试匹配什么吗?

Kev*_*ore 0

我不确定您是否已经找到解决此问题的方法。也许您可以尝试将 (spotify-callback) 更改route url为以下内容:

spotify-callback+窗口.location.hash