Skip to content

Commit c3e3e3e

Browse files
committed
Fix authentication flow process with correct two-step verification
1 parent c2f6bf5 commit c3e3e3e

2 files changed

Lines changed: 58 additions & 8 deletions

File tree

public/index.html

Lines changed: 29 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -285,7 +285,7 @@ <h3>Create a Flash Account</h3>
285285
</li>
286286
<li>
287287
<h3>Obtain API Credentials</h3>
288-
<p>Authenticate with Flash by entering the 6-digit code sent to your registered phone number via SMS. This one-time code will generate an authentication token for API access.</p>
288+
<p>Authentication requires a two-step process: first trigger a verification code to be sent to the user's phone with <code>userPhoneRegistrationInitiate</code>, then submit the code with <code>userLogin</code> to receive an authentication token. See the Authentication section below for detailed examples.</p>
289289
</li>
290290
<li>
291291
<h3>Set Up Your Environment</h3>
@@ -342,10 +342,35 @@ <h2 id="authentication">Authentication</h2>
342342
</div>
343343

344344
<h3>Authentication Process</h3>
345+
<p>Flash uses a two-step phone verification process for authentication:</p>
345346
<ol>
346347
<li>
347-
<strong>Request an auth token</strong> by sending a login mutation with your credentials:
348-
<div class="code-examples" data-operation="authentication"></div>
348+
<strong>Step 1: Initiate phone verification</strong> by sending a <code>userPhoneRegistrationInitiate</code> mutation with the phone number:
349+
<div class="code-sample" data-language="graphql">
350+
<pre>mutation {
351+
userPhoneRegistrationInitiate(input: { phone: "+1234567890" }) {
352+
success
353+
errors {
354+
message
355+
}
356+
}
357+
}</pre>
358+
</div>
359+
<p>This will trigger a 6-digit code to be sent via SMS to the specified phone number.</p>
360+
</li>
361+
<li>
362+
<strong>Step 2: Verify the code and obtain auth token</strong> by sending a <code>userLogin</code> mutation with the phone number and verification code:
363+
<div class="code-sample" data-language="graphql">
364+
<pre>mutation {
365+
userLogin(input: { phone: "+1234567890", code: "123456" }) {
366+
authToken
367+
errors {
368+
message
369+
}
370+
}
371+
}</pre>
372+
</div>
373+
<p>Upon successful verification, an authentication token will be returned.</p>
349374
</li>
350375
<li>
351376
<strong>Store the auth token</strong> securely in your application.
@@ -362,7 +387,7 @@ <h3>Authentication Process</h3>
362387
<div class="code-sample" data-language="javascript">
363388
<pre>// Check for authentication errors
364389
if (error.message === 'Unauthorized' || error.message === 'Token expired') {
365-
// Redirect to login or refresh token
390+
// Repeat the authentication process to get a new token
366391
}
367392
</pre>
368393
</div>

src/index.html

Lines changed: 29 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -285,7 +285,7 @@ <h3>Create a Flash Account</h3>
285285
</li>
286286
<li>
287287
<h3>Obtain API Credentials</h3>
288-
<p>Authenticate with Flash by entering the 6-digit code sent to your registered phone number via SMS. This one-time code will generate an authentication token for API access.</p>
288+
<p>Authentication requires a two-step process: first trigger a verification code to be sent to the user's phone with <code>userPhoneRegistrationInitiate</code>, then submit the code with <code>userLogin</code> to receive an authentication token. See the Authentication section below for detailed examples.</p>
289289
</li>
290290
<li>
291291
<h3>Set Up Your Environment</h3>
@@ -342,10 +342,35 @@ <h2 id="authentication">Authentication</h2>
342342
</div>
343343

344344
<h3>Authentication Process</h3>
345+
<p>Flash uses a two-step phone verification process for authentication:</p>
345346
<ol>
346347
<li>
347-
<strong>Request an auth token</strong> by sending a login mutation with your credentials:
348-
<div class="code-examples" data-operation="authentication"></div>
348+
<strong>Step 1: Initiate phone verification</strong> by sending a <code>userPhoneRegistrationInitiate</code> mutation with the phone number:
349+
<div class="code-sample" data-language="graphql">
350+
<pre>mutation {
351+
userPhoneRegistrationInitiate(input: { phone: "+1234567890" }) {
352+
success
353+
errors {
354+
message
355+
}
356+
}
357+
}</pre>
358+
</div>
359+
<p>This will trigger a 6-digit code to be sent via SMS to the specified phone number.</p>
360+
</li>
361+
<li>
362+
<strong>Step 2: Verify the code and obtain auth token</strong> by sending a <code>userLogin</code> mutation with the phone number and verification code:
363+
<div class="code-sample" data-language="graphql">
364+
<pre>mutation {
365+
userLogin(input: { phone: "+1234567890", code: "123456" }) {
366+
authToken
367+
errors {
368+
message
369+
}
370+
}
371+
}</pre>
372+
</div>
373+
<p>Upon successful verification, an authentication token will be returned.</p>
349374
</li>
350375
<li>
351376
<strong>Store the auth token</strong> securely in your application.
@@ -362,7 +387,7 @@ <h3>Authentication Process</h3>
362387
<div class="code-sample" data-language="javascript">
363388
<pre>// Check for authentication errors
364389
if (error.message === 'Unauthorized' || error.message === 'Token expired') {
365-
// Redirect to login or refresh token
390+
// Repeat the authentication process to get a new token
366391
}
367392
</pre>
368393
</div>

0 commit comments

Comments
 (0)