title: Installed Application Redirect uri mismatch on live site which is working on localhost
body: <p>I have developed an google analytics plugin , Getting URI mismatch error on authentication . It is <strong>working well on localhost</strong> , but when I installed it on a site, It displays this error.</p>
  
  <p>My redirect uri that is created on browser address bar during authentication and </p>
  
  <p><strong>showing error uri mismatch</strong></p>
  
  <blockquote>
    <p><a href="https://accounts.google.com/o/oauth2/auth?access_type=offline&amp;approval_prompt=auto&amp;scope=https%3A%2F%2Fwww.googleapis.com%2Fauth%2Fanalytics.readonly&amp;response_type=code&amp;redirect_uri=http%3A%2F%2Fapp.mysite.com%2Fwp-admin%2Fadmin.php%3Fpage%3Danalytica-admin-settings%2F&amp;client_id=id.apps.googleusercontent.com&amp;include_granted_scopes=true&amp;hl=en&amp;from_login=1&amp;as=6532dbe8b26fcb0f&amp;authuser=3" rel="nofollow noreferrer">https://accounts.google.com/o/oauth2/auth?access_type=offline&amp;approval_prompt=auto&amp;scope=https%3A%2F%2Fwww.googleapis.com%2Fauth%2Fanalytics.readonly&amp;response_type=code&amp;redirect_uri=http%3A%2F%2Fapp.mysite.com%2Fwp-admin%2Fadmin.php%3Fpage%3Danalytica-admin-settings%2F&amp;client_id=id.apps.googleusercontent.com&amp;include_granted_scopes=true&amp;hl=en&amp;from_login=1&amp;as=6532dbe8b26fcb0f&amp;authuser=3</a></p>
  </blockquote>
  
  <p>and on <strong>localhost something like this and it is working</strong></p>
  
  <blockquote>
    <p><a href="https://accounts.google.com/o/oauth2/auth?access_type=offline&amp;approval_prompt=auto&amp;scope=https%3A%2F%2Fwww.googleapis.com%2Fauth%2Fanalytics.readonly&amp;response_type=code&amp;redirect_uri=http%3A%2F%2Fhttp://localhost/test/%2Fwp-admin%2Fadmin.php%3Fpage%3Danalytica-admin-settings%2F&amp;client_id=id.apps.googleusercontent.com&amp;include_granted_scopes=true&amp;hl=en&amp;from_login=1&amp;as=6532dbe8b26fcb0f&amp;authuser=3" rel="nofollow noreferrer">https://accounts.google.com/o/oauth2/auth?access_type=offline&amp;approval_prompt=auto&amp;scope=https%3A%2F%2Fwww.googleapis.com%2Fauth%2Fanalytics.readonly&amp;response_type=code&amp;redirect_uri=http%3A%2F%2Fhttp://localhost/test/%2Fwp-admin%2Fadmin.php%3Fpage%3Danalytica-admin-settings%2F&amp;client_id=id.apps.googleusercontent.com&amp;include_granted_scopes=true&amp;hl=en&amp;from_login=1&amp;as=6532dbe8b26fcb0f&amp;authuser=3</a></p>
  </blockquote>
  
  <p><em>The only difference in bot the url is the redirect URI, one is one localhost and the other one is live .</em></p>
  
  <p>With " <code>urn:ietf:wg:oauth:2.0:oob</code>" as redirect URI with a popup for authentication is working fine on both local site on live site. But the URL I have mentioned is working on localhost , but not working on live site. </p>
  
  <p>on documentation <a href="https://developers.google.com/identity/protocols/OAuth2InstalledApp#choosingredirecturi" rel="nofollow noreferrer">choosing a redirect uri for insatlledApp</a></p>
  
  <p>**<a href="http://localhost[:port]" rel="nofollow noreferrer">http://localhost[:port]</a></p>
  
  <p><em>This value signals to the Google Authorization Server that the authorization code should be returned as a query string parameter to the web server on the client. To receive the authorization code using this URL, <strong>your application must be listening on the local web server.</strong> This is possible on many, but not all, platforms. If your platform supports it, this is the recommended mechanism for obtaining the authorization code.</em>
  **   Does it mean we can use it only on localhost ? but I have used a number of plugins which are using redirecturi for authorization .</p>
  
  <p>Can anyone give me a solution for this or any idea, how I can achieve this.</p>
  
  <p>This is how I am setting the redirect uri here.</p>
  
  <pre><code>$client-&gt;setRedirectUri( site_url() . '/wp-admin/admin.php?page=analytica-admin-settings');
  </code></pre>
  
  <p>Installed app does not need redirect uri to be set on console. 
  Check screenshot
  <a href="https://i.stack.imgur.com/sHQ6y.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/sHQ6y.png" alt="enter image description here"></a></p>