question

ryandj avatar image
ryandj asked

Google oauth api redirect uri

I'm trying to oauth to Google api and getting returned message of null. Where do I redirect the auth so I can get the access token please

apis
2 comments
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

JayZuo avatar image JayZuo ♦ commented ·

May I know what are you going to do? According to your previous question, it seems you want to use Google oauth api in CloudScript. As Seth said, please share more info, so that we can help you further.

0 Likes 0 ·
ryandj avatar image ryandj JayZuo ♦ commented ·

Hi sorry, I am trying to get auoth to Google apis to be able to call on there adsense api to receive a report. Currently I have made a bodge where iv obtained the refresh code from elese where and now can make the request but its not ideal. I'm not sure what to use as the redirect uri or how I can get the code from it I tried using the api endpoint in setting with no joy

0 Likes 0 ·
JayZuo avatar image
JayZuo answered

I'm not familiar with AdSense, but if you are using OAuth 2.0 flow here: https://developers.google.com/identity/protocols/OAuth2, then I'm afraid this won't work in CloudScript. As in this flow, Google displays a consent screen to the user, asking them to authorize your application to request some of their data. However, CloudScript is running in server side and there is no way to displays consent screen for user input.

10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

ryandj avatar image
ryandj answered

OK thank you on there doc there is a server to server using jwt but as you can't add a library will be to hard. I'll just have to stick with using the refresh token I have gotten using my browser manualyas it doesn't expire thanks lot for your help

1 comment
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

JayZuo avatar image JayZuo ♦ commented ·

Note that AdSense doesn't support Service Accounts, instead you must use the Installed Application flow. See https://developers.google.com/adsense/management/direct_requests. So server to server also not work here.

0 Likes 0 ·

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.