java - Spring : Google drive not opening window on live server -


i working on spring-mvc application in working on google drive integration. tested on localhost, , works fine. when uploaded code on server , trying authenticate, browser url wont automatically opened opened in localhost user give permissions. doing wrong. here authentication code :

controller code :

  @requestmapping(value = "/authorizeuser")     public string testgoogledrive(){         try {             this.drivequickstart.authorize();             return "redirect:/dashboard";         } catch (ioexception e) {             return "redirect:/denied";         }     } 

drivequickstartimpl :

@override     public credential authorize() throws ioexception {         inputstream in =                 drivequickstartimpl.class.getresourceasstream("/client_secret.json");         googleclientsecrets clientsecrets =                 googleclientsecrets.load(json_factory, new inputstreamreader(in));          googleauthorizationcodeflow flow =                 new googleauthorizationcodeflow.builder(                         http_transport, json_factory, clientsecrets, scopes)                         .setdatastorefactory(data_store_factory)                         .setaccesstype("offline")                         .build();         credential credential = new authorizationcodeinstalledapp(                 flow, new localserverreceiver()).authorize("user");         if(credential!=null && credential.getrefreshtoken() != null){             storecredentials(credential);         }         return credential;     } 

in tomcat console see :

https://accounts.google.com/o/oauth2/auth?access_type=offline&client_id=clientid&redirect_uri=http://localhost:39174/callback&response_type=code&scope=https://www.googleapis.com/auth/drive 

in client_secret.json, changed redirect_uri mysite.de , in developer console.

{"installed":{"client_id":"clientid","auth_uri":"https://accounts.google.com/o/oauth2/auth","token_uri":"https://accounts.google.com/o/oauth2/token","auth_provider_x509_cert_url":"https://www.googleapis.com/oauth2/v1/certs","client_email":"","client_x509_cert_url":"","client_secret":"mysecret","redirect_uris":["urn:ietf:wg:oauth:2.0:oob","http://mysite.de"]}} 

any nice know browser url not opening. lot.


Comments

Popular posts from this blog

android - Gradle sync Error:Configuration with name 'default' not found -

java - Andrioid studio start fail: Fatal error initializing 'null' -

html - jQuery UI Sortable - Remove placeholder after item is dropped -