refactor: Generate authentication steps from auth properties

This commit is contained in:
Faruk AYDIN
2022-11-10 18:49:49 +01:00
parent 6d3606abf0
commit 10e2794ff9
15 changed files with 115 additions and 599 deletions

View File

@@ -3,6 +3,7 @@ import verifyCredentials from './verify-credentials';
import isStillVerified from './is-still-verified';
export default {
generateAuthUrl: true,
fields: [
{
key: 'oAuthRedirectUrl',
@@ -42,82 +43,6 @@ export default {
clickToCopy: false,
},
],
authenticationSteps: [
{
type: 'mutation' as const,
name: 'createConnection',
arguments: [
{
name: 'key',
value: '{key}',
},
{
name: 'formattedData',
value: null,
properties: [
{
name: 'consumerKey',
value: '{fields.consumerKey}',
},
{
name: 'consumerSecret',
value: '{fields.consumerSecret}',
},
],
},
],
},
{
type: 'mutation' as const,
name: 'createAuthData',
arguments: [
{
name: 'id',
value: '{createConnection.id}',
},
],
},
{
type: 'openWithPopup' as const,
name: 'openAuthPopup',
arguments: [
{
name: 'url',
value: '{createAuthData.url}',
},
],
},
{
type: 'mutation' as const,
name: 'updateConnection',
arguments: [
{
name: 'id',
value: '{createConnection.id}',
},
{
name: 'formattedData',
value: null,
properties: [
{
name: 'oauthVerifier',
value: '{openAuthPopup.oauth_verifier}',
},
],
},
],
},
{
type: 'mutation' as const,
name: 'verifyConnection',
arguments: [
{
name: 'id',
value: '{createConnection.id}',
},
],
},
],
createAuthData,
verifyCredentials,