Discourse SSO Issue - Invalid Byte Sequence

I am getting an issue with SSO for one user. When I attempt to create the account for them I get this error:

ArgumentError (invalid byte sequence in UTF-8)
/var/www/discourse/lib/user_name_suggester.rb:11:in `=~'

Traceback:

/var/www/discourse/lib/user_name_suggester.rb:11:in `=~'
/var/www/discourse/lib/user_name_suggester.rb:11:in `parse_name_from_email'
/var/www/discourse/lib/user_name_suggester.rb:6:in `suggest'
/var/www/discourse/app/models/discourse_single_sign_on.rb:173:in `block in match_email_or_create_user'
/var/www/discourse/lib/distributed_mutex.rb:40:in `synchronize'
/var/www/discourse/lib/distributed_mutex.rb:10:in `synchronize'
/var/www/discourse/app/models/discourse_single_sign_on.rb:164:in `match_email_or_create_user'
/var/www/discourse/app/models/discourse_single_sign_on.rb:55:in `lookup_or_create_user'
/var/www/discourse/app/controllers/admin/users_controller.rb:449:in `sync_sso'

Other users work fine.

This user’s email and name don’t appear to contain special characters and the decoded SSO payload passes a UTF-8 validator without issue.

Discourse version: v2.3.0.beta2 +192

Can you post the username here?

We pass “external_id”, “name” and “email” as part of the SSO payload. We don’t pass a “username” and Discourse generates one for us.

I am not comfortable posting the payload in the forum, but could email it to you if it would be helpful.

Sure, can you PM the payload to @team?

Yes, I can do that. Sent.

1 Like

There’s nothing apparently wrong to me, we’ll have to get someone to look deeper…

anonymized:

Base64::decode64(payload).encode('US-ASCII')
=> "external_id=w26EQ468bNan1&email=a.bootjack@example.com&name=Abe"
1 Like