In a multitenant environment, I'm trying to use "g...
# support-questions-legacy
p
In a multitenant environment, I'm trying to use "getAuthorisationURLWithQueryParamsAndSetState(thirdPartyId, frontendRedirectURI) method" to get thirdparty login url, I'm having multiple tenants including public tenant. Public tenant don't have active-directory provider. But the other tenants have it. When I use that method, it's checking the public tenant. I'm using for logging in. I can pass tenant id from the front-end, but that method is not having a parameter to accept the tenant id. I'm struck here. Please help me out with this.
r
hey @phoenix1413. there is a callback in multitenancy.init on the frontend which you need to implement (Called
getTenantId
) which this function calls internally to get the tenant id.
p
Can't we change it at run time? I want the user to enter their email id in a box. From that email, I'm extracting tenant id.
r
ok. And i assume that the user enters the email before you want to show the providers right?
p
Yeah
r
like they enter the email, and then they click next or something
p
Exactly
r
in that case, when they enter the email, and you get the tenant ID, just save that in sessionStorage.
and then from the getTenantId callback, read from that storage to return the tenantId
and click on Custom UI on the right blue box
p
That's great. Thank you so much RP. ๐Ÿ˜Š
r
it's very close to what you want
p
I did exactly that now, but when the app hits authorisationurl api, it's giving 404. But when I used that api by copying from dev tools, it's giving me the authorisation url properly.
r
huh? Thats odd
what backend sdk version are you using?
and which backend sdk?
also, can i see the request that returns a 404?
p
It's python
Latest one
r
and which version of the python sdk is being used?
p
We are using latest python sdk only
r
can you open an issue about this? We will have a look asap.
p
Sure.
r
and whats the curl command that is working?
since you said when you manually query it, it works
p
I just opened that in browser, because it's just a get api
r
Huh.. thatโ€™s very very strange
p
Yeah, It's working in yarc as well.
r
@KShivendu any idea?
p
r
Can u copy the request from the network tab on chrome as curl and show it here?
p
http://localhost:3001/auth//authorisationurl?thirdPartyId=active-directory&redirectURIOnProviderDashboard=http%3A%2F%2Flocalhost%3A5173%2Fauth%2Fcallback%2Fsso
r
No I mean copy the request as curl
Right click on the request -> copy as curl
p
Ok
r
Which recipe have you initialised on the frontend and backend?
They need to be the same
p
curl "http://localhost:3001/auth//authorisationurl?thirdPartyId=active-directory&redirectURIOnProviderDashboard=http^%^3A^%^2F^%^2Flocalhost^%^3A5173^%^2Fauth^%^2Fcallback^%^2Fsso" ^ -H "Accept: */*" ^ -H "Accept-Language: en-US,en;q=0.9" ^ -H "Connection: keep-alive" ^ -H "Cookie: st-last-access-token-update=1695121393221" ^ -H "Origin: http://localhost:5173" ^ -H "Referer: http://localhost:5173/" ^ -H "Sec-Fetch-Dest: empty" ^ -H "Sec-Fetch-Mode: cors" ^ -H "Sec-Fetch-Site: same-site" ^ -H "User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/115.0.0.0 Safari/537.36" ^ -H "content-type: application/json" ^ -H "fdi-version: 1.17" ^ -H "rid: thirdparty" ^ -H "sec-ch-ua: ^\^"Not/A)Brand^\^";v=^\^"99^\^", ^\^"Google Chrome^\^";v=^\^"115^\^", ^\^"Chromium^\^";v=^\^"115^\^"" ^ -H "sec-ch-ua-mobile: ?0" ^ -H "sec-ch-ua-platform: ^\^"Windows^\^"" ^ -H "st-auth-mode: cookie" ^ --compressed
r
Which recipe have you initialised on the frontend and backend?
p
ThirdPartyEmailPassword, EmailVerification, ThirdParty, Multitenancy. Same in backend and frontend.
r
Right. So remove third party from frontend and backend. Just use thirdpartyemailpassword emailverification and multitenancy
The thirdpartyemailpassword can also be used to thirdparty only.
So all your imports from the frontend will also have to not use thirdparty anymore
p
ok @rp_st. I'll try and let you know what happened. I'm very very Thankful for you ๐Ÿ™‚
r
Yup! Happy to help
p
Thank God. It's finally working. I can sleep happily tonight. All credit goes to you @rp_st
r
awesome!
8 Views