I have developed an google analytics plugin , Getting URI mismatch error on authentication . It is working well on localhost , but when I installed it on a site, It displays this error.
My redirect uri that is created on browser address bar during authentication and
showing error uri mismatch
and on localhost something like this and it is working
The only difference in bot the url is the redirect URI, one is one localhost and the other one is live .
With ” urn:ietf:wg:oauth:2.0:oob
” 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.
on documentation choosing a redirect uri for insatlledApp
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, your application must be listening on the local web server. This is possible on many, but not all, platforms. If your platform supports it, this is the recommended mechanism for obtaining the authorization code.
** Does it mean we can use it only on localhost ? but I have used a number of plugins which are using redirecturi for authorization .
Can anyone give me a solution for this or any idea, how I can achieve this.
This is how I am setting the redirect uri here.
$client->setRedirectUri( site_url() . '/wp-admin/admin.php?page=analytica-admin-settings');
Installed app does not need redirect uri to be set on console.
Check screenshot