Open oshalygin opened 7 years ago
Debugging: Looks like it's properly set at the organization resolver.
Going line by line through all of the calls I narrowed down my problem, I wasnt mapping the organization to the application in the Admin portal! Ugh stupid mistake on my part!
After I attached all of the organizations to the application, things work!
Okay after quite a bit of research, the disconnect for Social Login with MultiTenancy appears to be that the organization is never passed down to getFormViewModel
.
Inside getFormViewModel
(https://github.com/stormpath/express-stormpath/blob/master/lib/helpers/get-form-view-model.js#L80-L101) we're looking for the accountStoreMapping at the application level instead of at the organization level.
Despite having the organization nameKey on hand in the request object(req.organization
, which gets set in default-organization-resolver.js
=> https://github.com/stormpath/express-stormpath/blob/master/lib/middleware/default-organization-resolver.js#L48-L50).
Looking at the structure of the application and separation through multi-tenancy via organizations:
Looking specifically at getProviders
and the call to getAccountStores
, in here we accept the application object instead of the organization object, which contains the accountStores for that organization and not the accountStores for the application:
https://github.com/stormpath/express-stormpath/blob/master/lib/helpers/get-form-view-model.js#L136-L139
This has been resolved with, https://github.com/stormpath/express-stormpath/commit/a558f8ca55e3515fe5e20cbd0fe4e7666be53ba5
Big thanks to @robertjd and the team at Stormpath.
Feel free to close this one out as I'm currently on the mt-social
branch but if you guys wanted to track this to make sure it makes it over to master then I understand leaving it open.
Thanks!!
Greetings gents, if anyone has any insight into what I may be doing wrong I'd be really love it. I've configured my application to match the documentation for MultiTenancy, but for some reason the subdomain isn't getting picked up and passed down to Stormpath, it just seems to default to the first organization. The JWT doesn't seem to store the organization either:
Documentation that I'm following: https://github.com/stormpath/express-stormpath/blob/2610219368dbe4bc32bdbcd69a0ce6d575626202/docs/multi_tenancy.rst
Also reading a lot into this PR: https://github.com/stormpath/express-stormpath/pull/538
My stormpath config which contains the multiTenancy config section
This is the
expandedJwt
object. I modified the actual values but this is the object thats returned back. As you can see, there's noorg
property underclaims
:Looking at the
/me
response that happens during the login step, the organization is also null