In Java how can i avoid or simplify reirecting the browser for code
17 views
Skip to first unread message
noor.gani
unread,
Sep 25, 2023, 5:26:50 AM9/25/23
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to google-ca...@googlegroups.com
Hi,
I am a java developer and integrating google calendar api, i am able to get the events from google but i want to simplify this process so that the user won't have to do copy-and-paste stuff for the authorization code to be received to get the access token? Currently all I know is that I will need to provide a callback url, but every time when the token expires we have to open the browser for that.
My Question is can I avoid this by opening the browser or simplify this.
My code is :
GoogleClientSecrets clientSecrets = GoogleClientSecrets.load(JSON_FACTORY, new InputStreamReader(in)); GoogleAuthorizationCodeFlow flow = new GoogleAuthorizationCodeFlow.Builder(HTTP_TRANSPORT, JSON_FACTORY, clientSecrets, SCOPES) .setDataStoreFactory(new FileDataStoreFactory(new java.io.File(TOKENS_DIRECTORY_PATH))) .setAccessType("offline").build(); LocalServerReceiver receiver = new LocalServerReceiver.Builder().setPort(8888).build(); Credential credential = new AuthorizationCodeInstalledApp(flow, receiver).authorize("user");
Best Regards, Noor.
Paulo Perez
unread,
Sep 25, 2023, 6:47:38 AM9/25/23
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to google-ca...@googlegroups.com
Hi Noor,
Sorry my delay, I`ll very pleasure to give assistance, but in this
moment I'm very busy, end of the day, I send you how I made my
development :)
Paulo
Em seg., 25 de set. de 2023 às 06:26, noor.gani
<noor.g...@gmail.com> escreveu: