I'm new in apigee. I need to make a callout in my proxy to fetch data from google fusion tables. FT Service require secure call using oath 2.0. I'm already made this workflow using custom proxy (without any OAUTH policy, and store token, refresh token and expiry in Key Value Map)
also I made js to calculate expiration time and condition callout to refresh token. I understand that this is not correct way but I still can't get a clue how to make this call using building Oauth policy. :( It's clear for me oauth process from google side but cant understand where i have store value and how to configure oauth as native way ...
I successfully deploy oauth-authcode example from github and get it work but when i change Default Target Endpoint URL on https://accounts.google.com/o/oauth2/auth and substitute my client_id i get error "Invalid client id : XXXXX.apps.googleusercontent.com. ClientId is Invalid".
Well as I understand the first issue is get Authorization code I have to make a call to google oauth like:
https://accounts.google.com/o/oauth2/auth
?response_type=code
&redirect_uri={URL that obtain access code}
&client_id=XXXXX.apps.googleusercontent.com
&scope=https://www.googleapis.com/auth/fusiontables
&access_type=offline
&approval_prompt=force
&[email protected]
&state=ANYSTATE
then google redirect authorization code to redirect_uri as
{redirect_uri}?code=ACCESSCODE&state=ANYSTATE
well i make a proxy /oauth20 as a bakckend and point it as redirect_uri.
How to configure oauth policy on this end to store this code ?
I create product Fusion and add API Proxy '/oauth20' as Resources Also I created Developer App Fusion.
What url i have to populate as Callback URL in Developer App?
Which url I have to use as redirect url for oauth policy and how can I store client id and client secret and scope that I use for google? I can't edit Consumer Key and Consumer Secret in Developer app
Well my api proxy obtain Authorization code.
How to change this code to access token?
In my app i make POST :
https://accounts.google.com/o/oauth2/token
code={code}
client_id={ClientID}
client_secret={ClientSecret}
redirect_uri=https://vatsenko-test.apigee.net/v1/oauth20/oauth/authorize
grant_type=authorization_code
and then extract token
$.access_token
$.refresh_token
$.expires_in
is any way to manually configure oauth flow to get token ? (i mean hardcode client_id, client_secret,and code to fetch token and store it to apigee and then make only verifyaccesstoken policy in callout)