GAM-team / got-your-back

Got Your Back (GYB) is a command line tool for backing up your Gmail messages to your computer using Gmail's API over HTTPS.
https://github.com/GAM-team/got-your-back/wiki
Apache License 2.0
2.61k stars 206 forks source link

Authorization Error #284

Closed mcdave1975 closed 3 years ago

mcdave1975 commented 4 years ago

HI JayOlee,

I try gyb email davelodia@twoseasonsresorts.com

try to paste the link this the error.

Authorization Error Error 400: admin_policy_enforced Access to your account data is restricted by policies within your organization. Please contact the administrator for twoseasonsresorts.com for more information. Request Details access_type=offline login_hint=davelodia@twoseasonsresorts.com response_type=code redirect_uri=urn:ietf:wg:oauth:2.0:oob state=196qnO9qPmzVDYsSFm3C0hCSx8OoKQ code_challenge_method=S256 hd=twoseasonsresorts.com prompt=consent client_id=683461650598 code_challenge=ZywNGYPbNjGeXjw4s-7EkPnrg9O0uL5bef2JCQO36s4 scope=https://www.googleapis.com/auth/userinfo.email https://www.googleapis.com/auth/gmail.readonly https://www.googleapis.com/auth/apps.groups.migration https://www.googleapis.com/auth/drive.appdata openid

stale[bot] commented 3 years ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs.

bryantech commented 2 years ago

Did you figure this out?

klatys commented 2 years ago

For anyone searching in future :) This worked for me, insted of client id in the guide use the one you see on the error page from google

Par-to commented 2 years ago

Can we wake this one up?

Part of the great google apps migration and an admitted noob.

I followed @klatys link above - substituting GAM for Interview Planner but still getting:

Authorization Error Error 400: admin_policy_enforced Access to your account data is restricted by policies within your organization. Please contact the administrator for xxxxx.co.nz for more information. The content in this section has been provided by the app developer. This content has not been reviewed or verified by Google. If you’re the app developer, make sure that these request details comply with Google policies.

access_type: offline
login_hint: nick@xxxxx.co.nz
response_type: code
redirect_uri: urn:ietf:wg:oauth:2.0:oob
state: jPTQDaVOdTX00KckoQSp6ZsJnrDYQO
code_challenge_method: S256
hd: xxxxx.co.nz
prompt: consent
client_id: 623641583239-snf24aeq4ul52be11mbem1c0ps6vnmad
code_challenge: DtNnkQwCumeUcwrlibSF1YElK5pnn0c9IcYOTY_OpVc
scope: https://www.googleapis.com/auth/userinfo.email https://mail.google.com/ https://www.googleapis.com/auth/apps.groups.migration https://www.googleapis.com/auth/drive.appdata openid
marcodallagatta commented 2 years ago

I successfully managed to fix this error by following this guide: https://medium.com/@dantasfiles/migrating-emails-from-g-suite-legacy-to-a-normal-gmail-account-with-got-your-back-f9f08543ff81

cliffordp commented 1 year ago

thank you @klatys and @marcodallagatta ! Because the articles could go down at any time, and neither was complete to address this specific issue, I'm documenting it directly in here:

Seeing this error? Error 400: admin_policy_enforced

Image 2023-03-14 at 6 54 25 AM

Click the "error details" to get your "client_id"

Image 2023-03-14 at 6 54 43 AM

In Google Admin, go to Security > API Controls > click "MANAGE THIRD-PARTY APP ACCESS"

Click "Add app" > "OAuth App Name Or Client ID"

image

In the Search field, paste the "client_id" you copied earlier, then click "Search" button:

image

Give it the permissions you choose, such as "trusted/all"

===

That was all in the DESTINATION account when attempting to Restore. After I did that, I then got this error: Error 403: org_internal

Image 2023-03-14 at 7 33 48 AM

So then I had to go back to the original/source/backup account's Google Cloud OAuth consent screen: https://console.cloud.google.com/apis/credentials/consent?project=**gyb-project-...**

Then click "MAKE EXTERNAL" then "Testing" in the popup

image

Then add your DESTINATION account's email address as a Test User:

Image 2023-03-14 at 7 30 38 AM

And then it worked 🥇