0
Fork 0
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:
Wang Sijie 2022-08-05 11:29:22 +08:00 committed by GitHub
parent 21a0c8f635
commit 380e2581fa
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 6 additions and 1 deletions

View file

@ -118,6 +118,7 @@ const { fromUint8Array } = require('js-base64');
const config = {
endpoint: '${props.endpoint}',
appId: '${props.appId}',
appSecret: '${props.appSecret}',
redirectUri: '${props.redirectUris[0] ?? 'http://localhost:3000/callback'}', // Configured in the previous step
scopes: withReservedScopes().split(' '),
};

View file

@ -116,6 +116,7 @@ const { fromUint8Array } = require('js-base64');
const config = {
endpoint: '${props.endpoint}',
appId: '${props.appId}',
appSecret: '${props.appSecret}',
redirectUri: '${props.redirectUris[0] ?? 'http://localhost:3000/callback'}', // 上一步配置过的 Redirect URI
scopes: withReservedScopes().split(' '),
};

View file

@ -59,6 +59,7 @@ import { LogtoProvider, LogtoConfig } from '@logto/next';
export const logtoClient = new LogtoClient({
endpoint: '${props.endpoint}',
appId: '${props.appId}',
appSecret: '${props.appSecret}',
baseUrl: 'http://localhost:3000', // Change to your own base URL
cookieSecret: '${generateRandomString(32)}', // Auto-generated 32 digit secret
cookieSecure: process.env.NODE_ENV === 'production',

View file

@ -59,6 +59,7 @@ import { LogtoProvider, LogtoConfig } from '@logto/next';
export const logtoClient = new LogtoClient({
endpoint: '${props.endpoint}',
appId: '${props.appId}',
appSecret: '${props.appSecret}',
baseUrl: 'http://localhost:3000', // 你可以修改为自己真实的 URL
cookieSecret: '${generateRandomString(32)}', // Logto 自动帮你生成的 32 位密钥
cookieSecure: process.env.NODE_ENV === 'production',

View file

@ -43,7 +43,7 @@ const Guides: Record<string, LazyExoticComponent<(props: MDXProps) => JSX.Elemen
};
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 [selectedSdk, setSelectedSdk] = useState<SupportedSdk>(sdks[0]);
const [activeStepIndex, setActiveStepIndex] = useState(-1);
@ -92,6 +92,7 @@ const Guide = ({ app, isCompact, onClose }: Props) => {
{GuideComponent && (
<GuideComponent
appId={appId}
appSecret={appSecret}
endpoint={window.location.origin}
redirectUris={oidcClientMetadata.redirectUris}
postLogoutRedirectUris={oidcClientMetadata.postLogoutRedirectUris}