Error: invalid_request - invalid parameter for redirect_uri: Missing authority

I have been working for several months and am getting hello.js to work with my PhoneGap application.

Just by focusing on Google at the moment, and when I redirect to PhoneGap browser, I am sent to error 400,

Error: invalid_request invalid parameter for redirect_uri: Missing authority file:///android_asset/www/index.html 

I followed the instructions on different sites to help with the setup, but it seems I could not get past this error.

My button:

 <button onclick="hello( 'google' ).login()">google</button> 

My javascript:

 <script type="text/javascript" src="js/hello.all.js"></script> <script> hello.on('auth.login', function(auth){ // call user information, for the given network hello( auth.network ).api( '/me' ).success(function(r){ var $target = $("#profile_"+ auth.network ); if($target.length==0){ $target = $("<div id='profile_"+auth.network+"'></div>").appendTo("#profile"); } $target.html('<img src="'+ r.thumbnail +'" /> Hey '+r.name).attr('title', r.name + " on "+ auth.network); }); }); hello.init({ google : 'MY_CLIENT_ID_IS_HERE.apps.googleusercontent.com' },{redirect_uri:'TRIED_VARIOUS_THINGS_HERE'}); </script> 

I tried redirect url http: // localhost (no space as it is here) I tried redirect url url: ietf: wg: oauth: 2.0: oob I tried redirecting url only oob

Google says my redirect is URIS

 REDIRECT URIS urn:ietf:wg:oauth:2.0:oob http://localhost 

Speaking to Andrew Dodson, who I believe is the creator of hello.js, he said:

 Its like redirect_uri hasn't been set, it defaults to window.location.href, 

He assured me that jQuery was not needed, but I was curious why the link to var $ target = $ ("# profile _" + auth.network); in the code example?

I do not use jQuery and prefer only a Javascript solution. Is there anyone who can explain the purpose of $ ("... in the code above and how can I use other code in it?

Many thanks

+5
source share

Source: https://habr.com/ru/post/1207482/


All Articles