What is the correct redirect url for chrome.identity.launchWebAuthFlow?

I would like to use the chrome.identity API in a chrome packaged application so that the user can authenticate with github .

On the application side, I am satisfied:

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

But I'm not sure if the redirect url should be on the github side. When the application will live, I will set the redirect URL to https://appidgoeshere.chromiumapp.org on the github application page, but I donโ€™t think the URL is available until the application is live.

Does anyone know where to specify the redirection when you write the application?

I am writing an application in Dart using the chrome.dart library, but I think the same problem exists if I write in plain javascript.

+7
javascript dart google-chrome-app github-api
source share
2 answers

This github auth chrome application example uses chrome.runtime.id to create a redirect URL:

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

Literature:

+6
source share

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

+10
source share

All Articles