@@ -6,7 +6,7 @@ You can view the Credentials related to a Project under the Project
6
6
` Settings > Credentials ` page. In this article, you'll learn how to manage your
7
7
credentials related to a project.
8
8
9
- ### View all Project Credentials
9
+ ## View all Project Credentials
10
10
11
11
Via this ` Credentials ` page, you can see a list of all Credentials, including
12
12
the name, type, and owner, and whether they are for a production environment.
21
21
22
22
:::
23
23
24
- ### Create a new Credential
24
+ ## Create a new Credential
25
25
26
26
1 . Click on the ` New Credential ` button, and choose the type of app you want to
27
27
connect.
@@ -53,13 +53,101 @@ ask on [Community](https://community.openfn.org).
53
53
54
54
![ New Credential Ready] ( /img/lightning_new_cred_ready.webp )
55
55
56
- ### Share Credentials
56
+ ## Keychain Credentials (Variable Auth)
57
+
58
+ Keychain credentials allow for a single job to make use of multiple credentials.
59
+ They work by inspecting the data in the job's runtime state (i.e., state.data)
60
+ and checking for the value of a predetermined identifier. Based on that value,
61
+ present in the data for a given source message, for example, another credential
62
+ will be selected and applied for that particular job run.
63
+
64
+ Keychain credentials allow for a single job to make use of multiple credentials.
65
+ They work by inspecting the data in the initial input for a given run (e.g.,
66
+ state.data) and checking for the value of a predetermined identifier.
67
+
68
+ Imagine you have 2 credentials in your project:
69
+
70
+ 1 . Taylor’s Login, External ID: abc123, Body:
71
+ ` { username: “tay”, password: “shhhhh” } `
72
+
73
+ 2 . Roina’s Login, External ID: def456, Body:
74
+ ` { username: “ro”, password: “veryshh” } `
75
+
76
+ And a job that uses a “Keychain Credential” with a path of ` $.data.myId ` .
77
+
78
+ If a job in your workflow uses the “Keychain Credential” and the initial
79
+ dataclip for a given run looks like this:
80
+
81
+ ``` json
82
+ {
83
+ "data" : {
84
+ "content" : " Hello world" ,
85
+ "myId" : " abc123"
86
+ }
87
+ }
88
+ ```
89
+
90
+ Then the keychain credential will search for abc123 in your project credentials
91
+ and provide those secrets to the same job. I.e., the will run with the “Taylor’s
92
+ Login” credential.
93
+
94
+ If another run is executed, and the initial dataclip for that run is:
95
+
96
+ ``` json
97
+ {
98
+ "data" : {
99
+ "content" : " Goodbye!" ,
100
+ "myId" : " def456"
101
+ }
102
+ }
103
+ ```
104
+
105
+ The same job will run with the “Roina’s Login” credential.
106
+
107
+ :::info Notes & Limitations
108
+
109
+ Since credential secrets are fetched at the start of a run (not the start of a
110
+ step) it’s not currently possible to resolve keychain credentials based on data
111
+ that is added to state later in a run. I.e., the data must be present in the
112
+ input dataclip for the whole run, not the input dataclip of the step that uses
113
+ the keychain credential.
114
+
115
+ :::
116
+
117
+ ### Create a Keychain Credential
118
+
119
+ 1 . On the ` Credentials ` page under project settings, click on the dropdown icon
120
+ on the ` Add New ` button to select the Keychain option:
121
+
122
+ ![ ] ( /img/keychain_credential_dropdown.webp )
123
+
124
+ 2 . Name your keychain credential and assign it a JSONPath expression. You can
125
+ also select a default credential to use when the JSONPath expression doesn't
126
+ match:
127
+
128
+ ![ ] ( /img/keychain_modal.webp )
129
+
130
+ 3 . Assign an external ID for your keychain to access by creating a new
131
+ credential or editing an existing credential:
132
+
133
+ ![ ] ( /img/assign_externalID.webp )
134
+
135
+ 4 . Now on a job in your workflow, you are able to select and use a keychain
136
+ credential:
137
+
138
+ ![ ] ( /img/keychain_selection.webp )
139
+
140
+ 5 . You can now reference your keychain in your input to use it:
141
+
142
+ ![ ] ( /img/keychain_input.webp )
143
+
144
+ ## Share Credentials
57
145
58
146
If you own a Credential, you can choose which Project has access to it. To
59
147
update which Projects your Credential is shared with, follow the steps on the
60
148
[ User Credentials docs page] ( /documentation/user-credentials ) .
61
149
62
- ### ` Raw JSON ` Credentials
150
+ ## ` Raw JSON ` Credentials
63
151
64
152
Raw credentials are valid JSON documents which are passed into a job's runtime
65
153
state. Note that owners of these credentials will be able to view them, in their
0 commit comments