Google Colab Authorization and Authentication

Hey Reader,

I'm here having noobie or say new_bie around google colab enviroment. I doing my first project called ClassroomAssignmetntChecker. And done alot ups and downs but thing is my error is obtainng "a major one" when I try to run and authenticate for Google Classroom Account for Authorization and Authentication the error:

Missing required parameter: redirect_uri Learn more about this errorIf you are a developer of AssignmentsChecking, see error details.Error 400: invalid_request

  1. I have created new Crendential.

  2. I have waited for an hour if reflection takes time.

  3. Ask Ai models.

  4. And added required scopes in Auth Consent.

 

 

 

 

 

 

def get_classroom_service():
        creds = None
        if os.path.exists(token_file):
            try:
                creds = Credentials.from_authorized_user_file(token_file, SCOPES)
                print("Token.json loaded successfully.")
            except json.JSONDecodeError:
                print("Token.json is invalid or empty. Re-authenticating.")

        if not creds or not creds.valid:
            flow = InstalledAppFlow.from_client_secrets_file(creds_file, SCOPES)
            # Remove redirect_uri to use the default within InstalledAppFlow
            auth_url, _ = flow.authorization_url(access_type='offline', prompt='consent')
            print(f"Please visit this URL to authorize your application: {auth_url}")
            code = input("Enter the authorization code: ")
            flow.fetch_token(code=code)
            creds = flow.credentials
            with open(token_file, 'w') as token:
                token.write(creds.to_json())
                print("Token.json created successfully.")

        service = build('classroom', 'v1', credentials=creds)
        return service

 

 

 

 

 

 

 

I'm new on the world of Google Colab and Python so take me as NooBie.

ps: this is my first project also i've contacted sales on google cloud so let see:)

If I have posted in wrong Board, pls let me know:)

Thanks to reading all!!

PS: Hey my errors are solved dw... thanks

0 0 90
0 REPLIES 0
Top Labels in this Space