Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

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.

like image 315
Rob Syme Avatar asked Aug 19 '13 10:08

Rob Syme


People also ask

What is a chrome ID?

Every app and extension in the Chrome Web Store has its own unique identification (ID) that doesn't change across versions. So, if a user installs a specific app or extension on multiple devices, it has the same ID on all devices. Each ID is 32 characters long. To find an app or extension ID: Open the Chrome Web Store.


2 Answers

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

like image 111
pwnall Avatar answered Nov 06 '22 04:11

pwnall


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
like image 30
Chris Buckett Avatar answered Nov 06 '22 03:11

Chris Buckett