PatrickMoore
Posts: 0
Joined: Sat Apr 28, 2012 3:45 am

Issue saving Access Token in Oauth2 process with Google

I am working with the Google Calendar API and have successfully gotten the code that is exchanged for the access token. I also can test my service for exchanging the code for the token, and I successfully get the token in the test. My issue is that I am trying to save that token to a local storage variable for use when the actual call is made to create the calendar entry, but it is not saving. I have looked at everything and am pretty sure either I am missing something painfully obvious or I have hit a bug of some type. Any chance of checking out my app to see which it is?

Illya Stepanov
Posts: 0
Joined: Mon Mar 18, 2013 8:48 am

Issue saving Access Token in Oauth2 process with Google

Hi Patric - Please, can you share your app with a href="mailto:support@appery.io" rel="nofollow"support@appery.io/a
We will check your application and try to figure out what the problem is.

PatrickMoore
Posts: 0
Joined: Sat Apr 28, 2012 3:45 am

Issue saving Access Token in Oauth2 process with Google

Just shared. The way it should work is you go to the settings page, click Connect with Google Calendar. It then retrieves the code to be used when retrieving the token. This part is working fine.

When it retrieves the code it also takes you to another screen a button to Finish and Return to Settings. I currently have this screen displaying the code to verify that is was retrieved. I will remove that before publishing, of course.

When you click the Finish and return to Settings button it executes the service GetToken with the code that was retrieved. This is where I am getting the issue.

I checked out the errors I was getting and it appears to be the Cross Domain issue that others have gotten, so the token is never retrieved. I generated the apk and tried running on my phone and still it doesn't work. I tried running it with the Appery proxy on, and it still didn't work. Those were the two things I found as possible work-arounds to test.

Hopefully there is something simple you will notice right away that I am doing wrong. I REALLY appreciate you taking a look. :-)

PatrickMoore
Posts: 0
Joined: Sat Apr 28, 2012 3:45 am

Issue saving Access Token in Oauth2 process with Google

BTW, the app name is Thoughtful3 that you should see.

Kateryna Grynko
Posts: 0
Joined: Thu Nov 15, 2012 9:13 am

Issue saving Access Token in Oauth2 process with Google

Hi Patrick,

After receiving the code the symbol "" is appended to it at the end. It works for Facebook, but not for Google. On "result" page in "Run JavaScript"action replace the following line:
codelocalStorage.setItem('code', vars.code + '');/codewith:
codelocalStorage.setItem('code', vars.code);/code
Similarly, on the page "connect" in "Run JavaScript" action on click event you should do exactly the same change in line 19.

PatrickMoore
Posts: 0
Joined: Sat Apr 28, 2012 3:45 am

Issue saving Access Token in Oauth2 process with Google

Thank you so much! I followed the Facebook example and thought I changed everything that was Facebook specific, but obviously I followed it too closely on that part.

I was pretty sure it was something simple that I was messing up. You guys are awesome, as is the Appery.io tool!

Return to “Issues”