Will Discourse ask for a username if it's not provided to /session/sso_login?

My account system does not have a username field: users log in with an email only. What will happen when I redirect the user to /session/sso_login and the username field in the payload is blank? Will Discourse correctly ask the user for that missing information?

I don’t see mention of this case in the SSO post. And although I see that username is an optional field, it seems like the implication is that it’s only optional if the user has a Discourse account already (ie: they aren’t new).

Thanks for your time! I realize I could code it up and just try it out myself, but it’d take a awhile to do so and I’m hoping one of you might be able to give a quick answer.

1 Like

We will auto-generate the username using provided fields, like email and name:

https://github.com/discourse/discourse/blob/80eace4268a7a86197bc412ea76f7610fd8a1283/lib/user_name_suggester.rb

5 Likes

Wonderful, thank you. That’s a super useful answer, and a super useful feature :slight_smile:: the difference between me being able to use SSO or not.

2 Likes