import React from 'react'; import superagent from 'superagent'; import { Link } from 'react-router-dom'; import { Container, Header, Segment, Table, Button, Icon, Label, Message, Loader, Checkbox } from 'semantic-ui-react'; /** * Developer portal home. * * Lists OAuth clients. Admin and SuperUser both see every client; only the * owner (or a SuperUser) can mutate a given row. The `canManage` flag the * backend returns per row drives the lock icon next to rows the viewer * can only read. SuperUsers get an extra toggle to include soft-deleted * clients in the list. */ export default class DevHome extends React.Component { constructor(props) { super(props); this.state = { loading: true, clients: [], viewerIsSuperUser: false, includeDeleted: false, error: null }; } async componentDidMount() { await this.fetchClients(); } async fetchClients() { this.setState({ loading: true, error: null }); try { const qs = this.state.includeDeleted ? '?includeDeleted=true' : ''; const res = await superagent.get(`/api/admin/oauth/clients${qs}`).accept('json'); this.setState({ clients: res.body.clients || [], viewerIsSuperUser: !!res.body.viewerIsSuperUser, loading: false }); } catch (e) { this.setState({ error: e.response?.body?.message || e.message, loading: false }); } } async onToggleIncludeDeleted() { this.setState({ includeDeleted: !this.state.includeDeleted }, () => this.fetchClients()); } renderClientRow(client) { const disabled = client.disabledAt !== null && client.disabledAt !== undefined; const deleted = client.deletedAt !== null && client.deletedAt !== undefined; return (
{client.clientId}{client.ownerAccountId}
{error}
Click "Register new client" above to create one. Remember: confidential clients only in v1, and each client must declare a whitelisted server IP.