freescout icon indicating copy to clipboard operation
freescout copied to clipboard

Unable to create new user using the Oauth module

Open modist opened this issue 1 year ago • 2 comments
trafficstars

PHP version: PHP 8.2.15 FreeScout version: 1.8.120 Database: Mysql (8.0.36-cll-lve) Are you using CloudFlare: Yes

when signin in I get this error message Error occurred creating a user.- I suspect that I do not get the nessecary data (email/name).

  • how can I validate this ?

entries in log DEBUG - Fields mapping: {"email":"unique_name","name":"given_name"} DEBUG - FreeScout user not found by email: Creating a new user {"email":false} DEBUG - User data after mapping: {"new_user_data":{"email":false,"password":"eyJpdiI6InBQaHkwbjRcLzFaaFA3VXlOUEFtcnlRPT0iLCJ2YWx1ZSI6IlVaT0FLcWJNUUxtQXMxTGM1SnJDUDN4ZjhjMUNkWkYzQWpVckNWeGhYRHM9IiwibWFjIjoiYzMwNDU1MzM1YjliMzgwMjU5NWFlZDdkZWU1Yjg3YThlNzhlNTcyODIzMDUxMmE3N2ExODAxODRlYzU4NGM4ZiJ9","no_password_hashing":true,"first_name":"Oauth","last_name":"User"}} Error occurred creating a user. {"new_user_data":{"email":false,"password":"eyJpdiI6InBQaHkwbjRcLzFaaFA3VXlOUEFtcnlRPT0iLCJ2YWx1ZSI6IlVaT0FLcWJNUUxtQXMxTGM1SnJDUDN4ZjhjMUNkWkYzQWpVckNWeGhYRHM9IiwibWFjIjoiYzMwNDU1MzM1YjliMzgwMjU5NWFlZDdkZWU1Yjg3YThlNzhlNTcyODIzMDUxMmE3N2ExODAxODRlYzU4NGM4ZiJ9","no_password_hashing":true,"first_name":"Oauth","last_name":"User"}}

modist avatar Feb 11 '24 22:02 modist

I suspect that I do not get the nessecary data (email/name).

Yes. You need to figure out why email is not retrieved.

freescout-helpdesk avatar Feb 18 '24 11:02 freescout-helpdesk

I found the reason - The plugin does not support ID_tokens.

With a few changes to the code - It works now.

I have email'ed the team my suggested changes to the module - for those interested :

in /Modules/OauthLogin/Http/Controllers/OauthLoginController.php replace line 102 ($user_data = $data;) with these 4 lines $parts = explode(".", $data['id_token']); $id_token = json_decode($parts[1], true); $jwt_payload = base64_decode($parts[1]); $user_data =json_decode($jwt_payload, true);

modist avatar Feb 19 '24 23:02 modist

We've added the patch to the module.

freescout-helpdesk avatar Feb 24 '24 10:02 freescout-helpdesk