It was a problem in the web2py/oauth20_account.py. A fix is in the repository now, but until a new stable version comes out this is what you need to change:
https://github.com/web2py/web2py/commit/28cc4446d90ad2f3877ceb293275ce1b2917f887 On Tuesday, October 5, 2021 at 3:51:25 PM UTC+2 Noobie wrote: > hi can you send me working code, i am fiddling with similar issue, > > On Friday, September 24, 2021 at 10:51:09 AM UTC+5:30 > muratkas...@gmail.com wrote: > >> Hi Dragan, >> I used this when upgrading. Maybe it helps you: >> try: >> # For Python 3.0 and later >> from urllib.request import urlopen >> except ImportError: >> # Fall back to Python 2's urllib2 >> from urllib2 import urlopen >> >> Best regards, >> Murat. >> >> >> >> >> Dragan Matic <perakoj...@gmail.com>, 23 Eyl 2021 Per, 13:06 tarihinde >> şunu yazdı: >> >>> >>> I have the oauth2.0 login enabled in my application as shown in the >>> oauth2.0 >>> example in the web2py book >>> <http://web2py.com/books/default/chapter/29/09/access-control#Other-login-methods-and-login-forms> >>> >>> using google and facebook as providers. >>> The application uses python2 and I am now trying to convert it to python >>> 3 and I am getting the following error: >>> >>> TypeError: POST data should be bytes, an iterable of bytes, or a file >>> object. It cannot be of type str. >>> >>> [image: error1.png] >>> >>> I have solved that by adding the "b" before the token url like this: >>> >>> TOKEN_URL=b"https://accounts.google.com/o/oauth2/token" >>> >>> but now I have the following error: >>> >>> AttributeError: 'int' object has no attribute 'decode' >>> >>> [image: error2.png] >>> >>> Is anybody using oauth2.0 with python3 and if yes, what changes need to >>> be made to the code? >>> >>> >>> -- >>> Resources: >>> - http://web2py.com >>> - http://web2py.com/book (Documentation) >>> - http://github.com/web2py/web2py (Source code) >>> - https://code.google.com/p/web2py/issues/list (Report Issues) >>> --- >>> You received this message because you are subscribed to the Google >>> Groups "web2py-users" group. >>> To unsubscribe from this group and stop receiving emails from it, send >>> an email to web2py+un...@googlegroups.com. >>> To view this discussion on the web visit >>> https://groups.google.com/d/msgid/web2py/5acd20a7-75e1-4b6e-895c-d7c47785145bn%40googlegroups.com >>> >>> <https://groups.google.com/d/msgid/web2py/5acd20a7-75e1-4b6e-895c-d7c47785145bn%40googlegroups.com?utm_medium=email&utm_source=footer> >>> . >>> >> -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups "web2py-users" group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/web2py/a3a1e0bd-6208-486c-a022-83841e95b141n%40googlegroups.com.