chrome.identity.launchWebAuthFlow的正确重定向网址是什么?

Rob*_*yme 7 javascript github-api oauth-2.0 dart google-chrome-app

我想在chrome打包的应用程序中使用chrome.identity API,以允许用户使用github进行身份验证.

从应用程序方面来说,我很满意:

chrome.identity.launchWebAuthFlow(
  {'url':'https://github.com/login/oauth/authorize?client_id=clientidgoeshere','interactive':true}, 
  functionToTakeRedirectURL
);
Run Code Online (Sandbox Code Playgroud)

但我不确定github端的重定向URL应该是什么.当应用程序处于活动状态时,我会在github应用程序页面上将重定向URL设置为https://appidgoeshere.chromiumapp.org,但我不认为在应用程序运行之前该URL可用.

在编写应用程序时,有人知道在哪里指向重定向?

我正在使用chrome.dart库在Dart中编写应用程序,但我认为如果我使用普通的javascript编写时存在同样的问题.

pwn*_*all 10

您可以使用chrome.identity.getRedirectURL,因此您无需在应用中对重定向网址模式进行硬编码.


Chr*_*ett 7

这个github auth chrome app示例用于chrome.runtime.id构建重定向URL:

 var redirectUri = 'https://' + chrome.runtime.id +
                  '.chromiumapp.org/provider_cb';
Run Code Online (Sandbox Code Playgroud)

参考文献: