Try ERPNext Buy Support Partners Foundation

Google Auth Problem

Hi everyone,

I have a problem with authentication to erpnext with google accounts. I can authenticate with a frappe account but I can’t with Google. I use erpnext v12 and python 2.7.

Thanks for helping :slight_smile:

Error message:

File “/home/*****/frappe-bench/env/local/lib/python2.7/site-packages/rauth/service.py”, line 24, in process_token_request
raise KeyError(PROCESS_TOKEN_ERROR.format(key=bad_key, raw=r.content))
KeyError: ‘Decoder failed to handle access_token with data as returned by provider. A different decoder may be needed. Provider returned: {\n “error”: “invalid_client”,\n “error_description”: “Unauthorized”\n}’

Okay, I solve it. My credentials are wrong. But I can’t understand something about google API integration. On the Integration module, there are two places that we can enter a google API key. The first is in Google Settings and the second is in Social Login Keys menu. I can’t understand the differences between them.

1

Trial and error is one way to find out -

And to inspect the database one can learn lots if that is your cup of tea.

Many settings are stored in the Singles doctype, for example this instance has two ‘Google’ related entries:

frappe@ubuntu:~/frappe-bench$ bench mariadb
Welcome to the MariaDB monitor.  Commands end with ; or \g.
Your MariaDB connection id is 36972
Server version: 10.2.22-MariaDB-10.2.22+maria~xenial-log mariadb.org binary distribution

Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

MariaDB [d56cb677eaab3383]> desc tabSingles;
+---------+--------------+------+-----+---------+-------+
| Field   | Type         | Null | Key | Default | Extra |
+---------+--------------+------+-----+---------+-------+
| doctype | varchar(255) | YES  | MUL | NULL    |       |
| field   | varchar(255) | YES  |     | NULL    |       |
| value   | text         | YES  |     | NULL    |       |
+---------+--------------+------+-----+---------+-------+
3 rows in set (0.00 sec)

MariaDB [d56cb677eaab3383]> select * from tabSingles where value like '%Google%';
+------------------+-----------+------------------------------------------------------------------------------------------------------------------------------
| doctype          | field     | value                                                                                                                        
+------------------+-----------+------------------------------------------------------------------------------------------------------------------------------
| Website Settings | head_html | <!-- Google Tag Manager -->
<script>(function(w,d,s,l,i){w[l]=w[l]||[];w[l].push({'gtm.start':
new Date().getTime(),event:'gtm.js'});var f=d.getElementsByTagName(s)[0],
j=d.createElement(s),dl=l!='dataLayer'?'&l='+l:'';j.async=true;j.src=
'https://www.googletagmanager.com/gtm.js?id='+i+dl;f.parentNode.insertBefore(j,f);
})(window,document,'script','dataLayer','GTM-5DD452');</script>
<!-- End Google Tag Manager --> |
| GSuite Settings  | client_id | 522926893973-k7re7k0ku06te6ifavifl79bc12bt0g.apps.googleusercontent.com                                                     
+------------------+-----------+------------------------------------------------------------------------------------------------------------------------------
2 rows in set (0.00 sec)