最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

javascript - What is the correct redirect URL for chrome.identity.launchWebAuthFlow? - Stack Overflow

programmeradmin0浏览0评论

I'd like to use the chrome.identity API in a chrome packaged app to allow the user to authenticate with github.

From the app side, I'm happy with:

chrome.identity.launchWebAuthFlow(
  {'url':'','interactive':true}, 
  functionToTakeRedirectURL
);

But I'm unsure what the redirect URL should be on the github side. When the app is live, I'll set the redirect url to on the github application page, but I don't think that url is available until the app is live.

Does anybody know where to point the redirect when you're writing the app?

I'm writing the app in Dart using the chrome.dart library, but I think the same problem exists if I was writing in plain javascript.

I'd like to use the chrome.identity API in a chrome packaged app to allow the user to authenticate with github.

From the app side, I'm happy with:

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

But I'm unsure what the redirect URL should be on the github side. When the app is live, I'll set the redirect url to https://appidgoeshere.chromiumapp.org on the github application page, but I don't think that url is available until the app is live.

Does anybody know where to point the redirect when you're writing the app?

I'm writing the app in Dart using the chrome.dart library, but I think the same problem exists if I was writing in plain javascript.

Share Improve this question edited Aug 20, 2013 at 16:09 sowbug 4,67223 silver badges29 bronze badges asked Aug 19, 2013 at 10:57 Rob SymeRob Syme 3622 silver badges11 bronze badges
Add a comment  | 

2 Answers 2

Reset to default 12

You can use chrome.identity.getRedirectURL so you don't have to hardcode the redirect URL pattern in your app.

This github auth chrome app sample uses chrome.runtime.id to build the redirect URL:

 var redirectUri = 'https://' + chrome.runtime.id +
                  '.chromiumapp.org/provider_cb';

References:

  • chrome.runtime
  • Sample app linked to from this (chrome app identity) page
发布评论

评论列表(0)

  1. 暂无评论