1

For getting OAUTH to work, the get redirect url changes each time I run it on a different computer.

var redirectUri = chrome.identity.getRedirectURL("https://www.google.com/"); 

That is the code I use to generate it, but the app id it returns in the form of https://[app-id].chromiumapp.org/*., has a different app-id on different computers.

This is an issue because I have to register the redirect url on the API site I'm using but it is different for every different person.

Here is the full code block

var redirectUri = chrome.identity.getRedirectURL("https://www.google.com/"); 
var auth_url = "https://accounts.spotify.com/authorize?client_id=" + client_id + "&redirect_uri=" + redirectUri + "&scope=user-library-modify%20user-read-email&response_type=token&state=123";
chrome.identity.launchWebAuthFlow({'url':auth_url,'interactive':true}, function(redirect_url){
    console.log(redirect_url)
});

Hardcoding it did not work either

pkothar2
  • 21
  • 4

1 Answers1

2

App ID only changes if you load the extension as unpacked, and its folder has a different absolute path.

There are 2 ways to pin the ID:

  1. Publish it to the Web Store. That will pin the ID for users that install from the Store.
  2. Add a "key" field to the manifest. This question is a good entry point for this.
Community
  • 1
  • 1
Xan
  • 74,770
  • 16
  • 179
  • 206
  • Thanks again Xan! How did you learn as much as you did about chrome extensions and javascript? You seem to have answered almost all of the Chrome Extension questions on SO – pkothar2 Jul 13 '16 at 19:53
  • Honestly, I don't know. I just started answering questions about extensions&apps. And learned a ton in the process. – Xan Jul 13 '16 at 20:09