(20241125) Swtiching domains.
This commit is contained in:
@@ -0,0 +1 @@
|
|||||||
|
{"web":{"client_id":"494562005604-huknn3ll9t0firtpsasf9q45umehebvv.apps.googleusercontent.com","project_id":"gmail-integration-442808","auth_uri":"https://accounts.google.com/o/oauth2/auth","token_uri":"https://oauth2.googleapis.com/token","auth_provider_x509_cert_url":"https://www.googleapis.com/oauth2/v1/certs","client_secret":"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","redirect_uris":["https://thecaoffice.com/nexcom/converse/callback/gmail"]}}
|
||||||
@@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
# Use this to run the microservice without any docker setup.
|
# Use this to run the microservice without any docker setup.
|
||||||
source .venv/bin/activate
|
source .venv/bin/activate
|
||||||
python3 "$(pwd)/api/main.py" --host "127.0.0.1" --port 5106 --workers 4 --script-id "kps_cnv_KBC3MoaU" &
|
python3 "$(pwd)/api/main.py" --host "0.0.0.0" --port 5106 --workers 4 --script-id "kps_cnv_KBC3MoaU" &
|
||||||
deactivate
|
deactivate
|
||||||
|
|
||||||
# All done:
|
# All done:
|
||||||
|
|||||||
@@ -306,12 +306,12 @@ if __name__ == "__main__":
|
|||||||
|
|
||||||
import dateparser
|
import dateparser
|
||||||
|
|
||||||
secrets_file = r"../../../creds/google_converse_test_oauth.json"
|
secrets_file = r"../../../creds/google_tcaoff_test_oauth_20241125.json"
|
||||||
secrets_dict = json.from_file(secrets_file)
|
secrets_dict = json.from_file(secrets_file)
|
||||||
|
|
||||||
my_goog = GoogleOAuth(
|
my_goog = GoogleOAuth(
|
||||||
config = secrets_dict,
|
config = secrets_dict,
|
||||||
redirect_url = r"https://nexcom.ditscentre.in/converse/test/callback",
|
redirect_url = r"https://thecaoffice.com/nexcom/converse/mail/callback/gmail",
|
||||||
debug = True,
|
debug = True,
|
||||||
debug_prefix = "OAuth (Goog) | "
|
debug_prefix = "OAuth (Goog) | "
|
||||||
)
|
)
|
||||||
@@ -319,29 +319,29 @@ if __name__ == "__main__":
|
|||||||
async def main():
|
async def main():
|
||||||
|
|
||||||
await my_goog.initialize(scopes = SCOPES_GMAIL_MAIL_MANAGEMENT)
|
await my_goog.initialize(scopes = SCOPES_GMAIL_MAIL_MANAGEMENT)
|
||||||
# await asyncio.sleep(1.0)
|
await asyncio.sleep(1.0)
|
||||||
# print("AUTH URL 0:", await my_goog.get_authorization_url(
|
print("AUTH URL 0:", await my_goog.get_authorization_url(
|
||||||
# user_id = "BHOPLI",
|
user_id = "BHOPLI",
|
||||||
# # email = "pskhushal@gmail.com"
|
# email = "pskhushal@gmail.com"
|
||||||
# ))
|
))
|
||||||
|
|
||||||
|
redirect_url = input("Paste the redirect URL here: ")
|
||||||
|
print("TOKENS:", json.to_string(await my_goog.get_tokens(redirect_url = redirect_url), default = str))
|
||||||
|
|
||||||
|
# old_tok = {
|
||||||
|
# "access_token": "ya29.a0AeDClZAjmLUZ1hh0aTbddz4ThjRzwQNMwdi_H4AYO-C4ETvWpK8aHYz5eV9PTUlFDJKQoHYtFgu4u2XfoiOdIEMVNwAKFbb8sakIWef7Yk5HdiDYC0A-MUp5XZnoNGLuP_GW_O3IxfCLH7cC0fb3AfHx4OsBpa_Qu1X-IpvfaCgYKAaoSARMSFQHGX2MiX81qoRex393eWE229OMCUg0175",
|
||||||
|
# "refresh_token": "1//0g4mVQrydnc1ECgYIARAAGBASNgF-L9Irk_UxcRjgkz_YyK5Ujs1qCaj8nKL7bqQ0jHnHYlpVRh_Pwm77X4Angp8R-o-fgmKfzg",
|
||||||
|
# "expires_in": 3539,
|
||||||
|
# "expires_at": dateparser.parse("2024-11-25 09:24:56.690876+00:00"),
|
||||||
|
# "token_type": "Bearer",
|
||||||
|
# "scopes": [
|
||||||
|
# "https://www.googleapis.com/auth/gmail.labels",
|
||||||
|
# "https://www.googleapis.com/auth/gmail.modify"
|
||||||
|
# ]
|
||||||
|
# }
|
||||||
#
|
#
|
||||||
# redirect_url = input("Paste the redirect URL here: ")
|
# new_tok = await my_goog.refresh_tokens(old_tokens = old_tok)
|
||||||
# print("TOKENS:", json.to_string(await my_goog.get_tokens(redirect_url = redirect_url), default = str))
|
# print("NEW TOKENS:", json.to_string(new_tok, default = str))
|
||||||
|
|
||||||
old_tok = {
|
|
||||||
"access_token": "ya29.a0AeDClZAjmLUZ1hh0aTbddz4ThjRzwQNMwdi_H4AYO-C4ETvWpK8aHYz5eV9PTUlFDJKQoHYtFgu4u2XfoiOdIEMVNwAKFbb8sakIWef7Yk5HdiDYC0A-MUp5XZnoNGLuP_GW_O3IxfCLH7cC0fb3AfHx4OsBpa_Qu1X-IpvfaCgYKAaoSARMSFQHGX2MiX81qoRex393eWE229OMCUg0175",
|
|
||||||
"refresh_token": "1//0g4mVQrydnc1ECgYIARAAGBASNgF-L9Irk_UxcRjgkz_YyK5Ujs1qCaj8nKL7bqQ0jHnHYlpVRh_Pwm77X4Angp8R-o-fgmKfzg",
|
|
||||||
"expires_in": 3539,
|
|
||||||
"expires_at": dateparser.parse("2024-11-25 09:24:56.690876+00:00"),
|
|
||||||
"token_type": "Bearer",
|
|
||||||
"scopes": [
|
|
||||||
"https://www.googleapis.com/auth/gmail.labels",
|
|
||||||
"https://www.googleapis.com/auth/gmail.modify"
|
|
||||||
]
|
|
||||||
}
|
|
||||||
|
|
||||||
new_tok = await my_goog.refresh_tokens(old_tokens = old_tok)
|
|
||||||
print("NEW TOKENS:", json.to_string(new_tok, default = str))
|
|
||||||
|
|
||||||
|
|
||||||
asyncio.run(main())
|
asyncio.run(main())
|
||||||
|
|||||||
Reference in New Issue
Block a user