WebUI for Trusty Rex.
Required environment variables:
- API_BASE_PATH
- API_KEY
This project uses SvelteKit Auth and you can provide a DynamicSvelteKitAuthConfig
(docs reference) via the DYNAMIC_AUTH_CONFIG
environment variable .
This configures two providers, one for credentials (username + password in this case) and one for Auth0.
DYNAMIC_AUTH_CONFIG=async()=>{return{secret:'<secret>',trustHost:!0,providers:[(await import('@auth/core/providers/credentials')).default({name:'Credentials',credentials:{username:{label:'Username',type:'text'},password:{label:'Password',type:'password'}},async authorize(credentials,req){if(credentials.username==='jsmith'&&credentials.password==='password'){return{id:'1',name:'J Smith',email:'[email protected]'}}else{return null}}}),{id:"auth0",name:"Auth0",wellKnown:"https://trusty-rex-station.eu.auth0.com/.well-known/openid-configuration",type:"oidc",clientId:"<clientId>",clientSecret:"<clientSecret>",issuer:"https://trusty-rex-station.eu.auth0.com"}]}}
Readable version:
async () => {
return {
secret: '<secret>',
trustHost: true,
providers: [
(await import('@auth/core/providers/credentials')).default({
name: 'Credentials',
credentials: {
username: {
label: 'Username',
type: 'text'
},
password: {
label: 'Password',
type: 'password'
}
},
async authorize(credentials, req) {
if (credentials.username === 'jsmith' && credentials.password === 'password') {
return {
id: '1',
name: 'J Smith',
email: '[email protected]'
};
} else {
return null;
}
}
}),
{
id: 'auth0',
name: 'Auth0',
wellKnown: 'https://trusty-rex-station.eu.auth0.com/.well-known/openid-configuration',
type: 'oidc',
clientId: '<clientId>',
clientSecret: '<clientSecret>',
issuer: 'https://trusty-rex-station.eu.auth0.com'
}
]
};
};
Here an js minifier that worked for top level asyn for your convinience: https://www.minifier.org/
Install dependencies with yarn install
), start a development server:
yarn run dev