mirror of
https://github.com/logto-io/logto.git
synced 2024-12-16 20:26:19 -05:00
feat(console): add app secret to guide (#1735)
This commit is contained in:
parent
21a0c8f635
commit
380e2581fa
5 changed files with 6 additions and 1 deletions
|
@ -118,6 +118,7 @@ const { fromUint8Array } = require('js-base64');
|
||||||
const config = {
|
const config = {
|
||||||
endpoint: '${props.endpoint}',
|
endpoint: '${props.endpoint}',
|
||||||
appId: '${props.appId}',
|
appId: '${props.appId}',
|
||||||
|
appSecret: '${props.appSecret}',
|
||||||
redirectUri: '${props.redirectUris[0] ?? 'http://localhost:3000/callback'}', // Configured in the previous step
|
redirectUri: '${props.redirectUris[0] ?? 'http://localhost:3000/callback'}', // Configured in the previous step
|
||||||
scopes: withReservedScopes().split(' '),
|
scopes: withReservedScopes().split(' '),
|
||||||
};
|
};
|
||||||
|
|
|
@ -116,6 +116,7 @@ const { fromUint8Array } = require('js-base64');
|
||||||
const config = {
|
const config = {
|
||||||
endpoint: '${props.endpoint}',
|
endpoint: '${props.endpoint}',
|
||||||
appId: '${props.appId}',
|
appId: '${props.appId}',
|
||||||
|
appSecret: '${props.appSecret}',
|
||||||
redirectUri: '${props.redirectUris[0] ?? 'http://localhost:3000/callback'}', // 上一步配置过的 Redirect URI
|
redirectUri: '${props.redirectUris[0] ?? 'http://localhost:3000/callback'}', // 上一步配置过的 Redirect URI
|
||||||
scopes: withReservedScopes().split(' '),
|
scopes: withReservedScopes().split(' '),
|
||||||
};
|
};
|
||||||
|
|
|
@ -59,6 +59,7 @@ import { LogtoProvider, LogtoConfig } from '@logto/next';
|
||||||
export const logtoClient = new LogtoClient({
|
export const logtoClient = new LogtoClient({
|
||||||
endpoint: '${props.endpoint}',
|
endpoint: '${props.endpoint}',
|
||||||
appId: '${props.appId}',
|
appId: '${props.appId}',
|
||||||
|
appSecret: '${props.appSecret}',
|
||||||
baseUrl: 'http://localhost:3000', // Change to your own base URL
|
baseUrl: 'http://localhost:3000', // Change to your own base URL
|
||||||
cookieSecret: '${generateRandomString(32)}', // Auto-generated 32 digit secret
|
cookieSecret: '${generateRandomString(32)}', // Auto-generated 32 digit secret
|
||||||
cookieSecure: process.env.NODE_ENV === 'production',
|
cookieSecure: process.env.NODE_ENV === 'production',
|
||||||
|
|
|
@ -59,6 +59,7 @@ import { LogtoProvider, LogtoConfig } from '@logto/next';
|
||||||
export const logtoClient = new LogtoClient({
|
export const logtoClient = new LogtoClient({
|
||||||
endpoint: '${props.endpoint}',
|
endpoint: '${props.endpoint}',
|
||||||
appId: '${props.appId}',
|
appId: '${props.appId}',
|
||||||
|
appSecret: '${props.appSecret}',
|
||||||
baseUrl: 'http://localhost:3000', // 你可以修改为自己真实的 URL
|
baseUrl: 'http://localhost:3000', // 你可以修改为自己真实的 URL
|
||||||
cookieSecret: '${generateRandomString(32)}', // Logto 自动帮你生成的 32 位密钥
|
cookieSecret: '${generateRandomString(32)}', // Logto 自动帮你生成的 32 位密钥
|
||||||
cookieSecure: process.env.NODE_ENV === 'production',
|
cookieSecure: process.env.NODE_ENV === 'production',
|
||||||
|
|
|
@ -43,7 +43,7 @@ const Guides: Record<string, LazyExoticComponent<(props: MDXProps) => JSX.Elemen
|
||||||
};
|
};
|
||||||
|
|
||||||
const Guide = ({ app, isCompact, onClose }: Props) => {
|
const Guide = ({ app, isCompact, onClose }: Props) => {
|
||||||
const { id: appId, name: appName, type: appType, oidcClientMetadata } = app;
|
const { id: appId, secret: appSecret, name: appName, type: appType, oidcClientMetadata } = app;
|
||||||
const sdks = applicationTypeAndSdkTypeMappings[appType];
|
const sdks = applicationTypeAndSdkTypeMappings[appType];
|
||||||
const [selectedSdk, setSelectedSdk] = useState<SupportedSdk>(sdks[0]);
|
const [selectedSdk, setSelectedSdk] = useState<SupportedSdk>(sdks[0]);
|
||||||
const [activeStepIndex, setActiveStepIndex] = useState(-1);
|
const [activeStepIndex, setActiveStepIndex] = useState(-1);
|
||||||
|
@ -92,6 +92,7 @@ const Guide = ({ app, isCompact, onClose }: Props) => {
|
||||||
{GuideComponent && (
|
{GuideComponent && (
|
||||||
<GuideComponent
|
<GuideComponent
|
||||||
appId={appId}
|
appId={appId}
|
||||||
|
appSecret={appSecret}
|
||||||
endpoint={window.location.origin}
|
endpoint={window.location.origin}
|
||||||
redirectUris={oidcClientMetadata.redirectUris}
|
redirectUris={oidcClientMetadata.redirectUris}
|
||||||
postLogoutRedirectUris={oidcClientMetadata.postLogoutRedirectUris}
|
postLogoutRedirectUris={oidcClientMetadata.postLogoutRedirectUris}
|
||||||
|
|
Loading…
Reference in a new issue