Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Minor JIT provisioning improvements #369

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

## Not released

- Minor JIT provisioning flow improvements [#369](https://github.com/CartoDB/carto-react-template/pull/369)

## 2.3

## 2.3.0 (2023-11-30)
Expand Down
5 changes: 2 additions & 3 deletions template-base-3-typescript/template/src/hooks/Auth0.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ export default function useAuth() {

const accountsUrl = initialState.accountsUrl;
const organizationId = initialState.oauth?.organizationId;
const namespace = initialState.oauth?.namespace;

const hasForceLogin = searchParams.has(FORCE_LOGIN_PARAM);

Expand All @@ -25,8 +24,8 @@ export default function useAuth() {

const userMetadata = useMemo(() => {
if (!user) return;
return user[`${namespace}user_metadata`];
}, [user, namespace]);
return user['http://app.carto.com/user_metadata'];
}, [user]);

const redirectAccountUri = useMemo(() => {
return `${accountsUrl}${organizationId ? `sso/${organizationId}` : ''}`;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,11 @@ export const initialState: InitialCarto3State = {
},
googleApiKey: '', // only required when using a Google Basemap,
googleMapId: '', // only required when using a Google Custom Basemap
accountsUrl: 'http://app.carto.com/',
accountsUrl: 'https://app.carto.com/',
oauth: {
domain: 'auth.carto.com',
clientId: '', // type here your application clientId
organizationId: '', // organizationId is required for SSO
namespace: 'http://app.carto.com/',
scopes: [
'read:current_user',
'update:current_user',
Expand Down
5 changes: 2 additions & 3 deletions template-base-3/template/src/hooks/Auth0.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ export default function useAuth() {

const accountsUrl = initialState.accountsUrl;
const organizationId = initialState.oauth?.organizationId;
const namespace = initialState.oauth?.namespace;

const hasForceLogin = searchParams.has(FORCE_LOGIN_PARAM);

Expand All @@ -25,8 +24,8 @@ export default function useAuth() {

const userMetadata = useMemo(() => {
if (!user) return;
return user[`${namespace}user_metadata`];
}, [user, namespace]);
return user['http://app.carto.com/user_metadata'];
}, [user]);

const redirectAccountUri = useMemo(() => {
return `${accountsUrl}${organizationId ? `sso/${organizationId}` : ''}`;
Expand Down
3 changes: 1 addition & 2 deletions template-base-3/template/src/store/initialStateSlice.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,8 @@ export const initialState = {
},
googleApiKey: '', // only required when using a Google Basemap
googleMapId: '', // only required when using a Google Custom Basemap
accountsUrl: 'http://app.carto.com/',
accountsUrl: 'https://app.carto.com/',
oauth: {
namespace: 'http://app.carto.com/',
domain: 'auth.carto.com',
clientId: '', // type here your application clientId
organizationId: '', // organizationId is required for SSO
Expand Down
5 changes: 2 additions & 3 deletions template-sample-app-3/template/src/hooks/Auth0.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ export default function useAuth() {

const accountsUrl = initialState.accountsUrl;
const organizationId = initialState.oauth?.organizationId;
const namespace = initialState.oauth?.namespace;

const hasForceLogin = searchParams.has(FORCE_LOGIN_PARAM);

Expand All @@ -25,8 +24,8 @@ export default function useAuth() {

const userMetadata = useMemo(() => {
if (!user) return;
return user[`${namespace}user_metadata`];
}, [user, namespace]);
return user['http://app.carto.com/user_metadata'];
}, [user]);

const redirectAccountUri = useMemo(() => {
return `${accountsUrl}${organizationId ? `sso/${organizationId}` : ''}`;
Expand Down