Connect Gmail to Odoo using Google OAuth

Odoo는 Google Gmail용 OAuth와 호환됩니다. 사용자 지정 도메인에서 보안 이메일을 보내려면 Google의 작업 공간 플랫폼과 Odoo 데이터베이스의 백엔드에서 몇 가지 설정만 구성하면 됩니다. 해당 설정 내용은 개인 이메일 주소 또는 사용자 지정 도메인에서 만든 주소를 활용하여 작동합니다.

For more information, visit Google’s documentation on setting up OAuth.

Google 설정하기

Create a new project

시작하려면 Google API 콘솔 로 이동합니다. Google Workspace 계정이 있는 경우 로그인하며, 계정이 없으면 개인 Gmail 계정으로 로그인합니다 (Odoo에서 설정하려는 이메일 주소와 일치해야 합니다).

그런 다음, OAuth 동의 화면 의 가장 오른쪽에 있는 프로젝트 생성`을 클릭합니다. 이 계정에서 이미 생성한 프로젝트가 있는 경우에는, :guilabel:`신규 프로젝트 옵션을 프로젝트 선택 드롭다운 메뉴 아래의 화면 오른쪽 상단에서 확인할 수 있습니다.

새 프로젝트 화면에서 프로젝트명` 의 이름을 Odoo 로 바꾸고 위치 를 찾습니다. 위치Google Workspace 조직 으로 설정합니다. Gmail 개인 계정을 사용하는 경우 위치조직 없음 으로 그대로 둡니다.

Project Name and Location for Google OAuth.

Click on Create to finish this step.

Edit app registration

Next we will configure the app registration of the project.

On the OAuth consent screen step, under the App information section, enter Odoo in the App name field. Select the organization’s email address under the User support email field.

Next, under App Domain ‣ Authorized domains, click on Add Domain and enter odoo.com.

After that, under the Developer contact information section, enter the organization’s email address. Google uses this email address to notify the organization about any changes to your project.

Next, click on the Save and Continue button. Then, skip the Scopes page by scrolling to the bottom and clicking on Save and Continue.

테스트 모드 (외부)에서 계속 사용하려면 테스트 사용자 단계에서 설정 중인 이메일 주소를 추가하고 사용자 추가 를 클릭한 다음 저장 후 계속 버튼을 클릭합니다. 앱 등록과 관련된 요약이 나타납니다.

Finally, scroll to the bottom and click on Back to Dashboard to finish setting up the project.

자격 증명 생성

Now that the project is set up, credentials should be created, which includes the Client ID and Client Secret. First, click on Credentials in the left sidebar menu.

Then, click on Create Credentials in the top menu and select OAuth client ID from the dropdown menu.

  • Under Application Type, select Web Application from the dropdown menu.

  • In the Name field, enter Odoo.

  • 인증된 리디렉션 URI 라벨 아래에 있는 URI 추가 버튼을 클릭한 다음 URI 1https://yourdbname.odoo.com/google_gmail/confirm 을 입력합니다. URL의 yourdbname 부분을 실제 Odoo 데이터베이스 이름으로 바꿔야 합니다.

  • 다음으로 만들기 를 클릭하여 OAuth 클라이언트 ID클라이언트 비밀번호 를 생성합니다. 마지막으로 나중에 Odoo에서 설정할 때 사용할 수 있도록 값을 생성하여 복사한 다음 Odoo 데이터베이스로 이동합니다.

Client ID and Client Secret for Google OAuth.

Odoo에서 설정하기

Enter Google Credentials

First, open Odoo and navigate to the Apps module. Then, remove the Apps filter from the search bar and type in Google. Install the module called Google Gmail.

다음으로, 설정 ‣ 일반 설정 으로 이동하여 메일 및 채팅 섹션에서 사용자 지정 이메일 서버 또는 외부 이메일 서버 확인란이 선택되어 있는지 확인합니다. 확인했습니다. 그러면 Gmail 자격 증명 또는 Gmail 서버 사용 에 대한 새로운 선택 항목이 입력됩니다. 그런 다음 각 값을 클라이언트 ID클라이언트 비밀 에 복사하여 붙여넣고 설정을 :guilabel:`저장`합니다.

발신 이메일 서버 환경 설정

To configure the external Gmail account, return to the top of the Custom Email Servers setting and then click the Outgoing Email Servers link.

Configure Outgoing Email Servers in Odoo.

Then, click on New or Create to create a new email server, and fill in the Name, Description, and the email Username (if required).

Next, click on Gmail OAuth Authentication or Gmail (under the Authenticate with or Connection section). Finally, click on Connect your Gmail Account.

A new window labeled Google opens to complete the authorization process. Select the appropriate email address that is being configured in Odoo.

If the email address is a personal account, then an extra step pops up, so click Continue to allow the verification and connect the Gmail account to Odoo.

그런 다음 계속 또는 허용 을 클릭하여 Odoo에서 Google 계정에 액세스하도록 허용합니다. 그 후 Odoo에 새로 설정된 발신 이메일 서버로 페이지를 다시 이동합니다. 환경 설정을 통해 자동으로 Odoo에 토큰이 로드되고 Gmail 토큰 유효 라는 태그가 초록색으로 표시됩니다.

Configure Outgoing Email Servers in Odoo.

Finally, Test the Connection. A confirmation message should appear. The Odoo database can now send safe, secure emails through Google using OAuth authentication.

Google OAuth FAQ

Production VS Testing Publishing Status

Choosing Production as the Publishing Status (instead of Testing) will display the following warning message:

OAuth is Limited to 100 Sensitive Scope Logins.

To correct this warning, navigate to the Google API Platform. If the Publishing status is In Production, click Back to Testing to correct the issue.

No Test Users Added

If no test users are added to the OAuth consent screen, then a 403 access denied error will populate.

403 Access Denied Error.

이 오류를 수정하려면 API 및 서비스 아래에 있는 OAuth 동의 화면 으로 돌아가서 테스트 사용자를 앱에 추가합니다. Odoo에서 설정하고 있는 이메일을 추가합니다.

Gmail Module not updated

If the Google Gmail module in Odoo has not been updated to the latest version, then a Forbidden error message populates.

Forbidden you don't have the permission to access the requested resource.

이 오류를 수정하려면 모듈로 이동하여 검색어를 삭제합니다. 그런 다음 Gmail 또는 Google 을 검색한 후 Google Gmail 모듈을 업그레이드합니다. 마지막으로 모듈 오른쪽 상단에 있는 세 개의 점을 클릭한 후 업그레이드 를 선택합니다.

Application Type

When creating the credentials (OAuth Client ID and Client Secret), if Desktop App is selected for the Application Type, an Authorization Error appears.

Error 400 Redirect URI Mismatch.

이 오류를 수정하려면 이미 생성된 자격 증명을 삭제한 후 애플리케이션 유형 으로 웹 애플리케이션 을 선택하여 새 자격 증명을 생성합니다. 그런 다음 인증된 리디렉션 URI 에서 URI 추가 를 클릭하고 필드에 https://yourdbname.odoo.com/google_gmail/confirm 을 입력하며, yourdbname 을 Odoo 데이터베이스 이름이 포함된 URL으로 바꾸어야 합니다.