# Onfido? Stripe? Client Credential Flow?

**URL:** <https://community.auth0.com/t/onfido-stripe-client-credential-flow/55330>\
**Category:** Get Help\
**Tags:** client-credentials\
**Created:** [December 24, 2020, 11:12am UTC](https://community.auth0.com/t/onfido-stripe-client-credential-flow/55330 "2020-12-24T11:12:39Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![austinchan](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/austinchan/32/12931_2.png) [@austinchan](https://community.auth0.com/u/austinchan)\
**Post date:** [December 24, 2020, 11:12am UTC](https://community.auth0.com/t/onfido-stripe-client-credential-flow/55330/1 "2020-12-24T11:12:39Z")

</div>

Hi everyone! 🙋‍♂️

I’ve been thinking how do we secure and protect our API as service provider like Onfido or Stripe.

For this example, imagine we’re service provider like Onfido. Short intro about Onfido, they provide kyc solution for businesses to verify people’s identity by using ID document, selfie photo, etc.

In order for our customer to use our service(API), developer need to register a user account and create an application from our dashboard, we will then provide the **Client ID** & **Client Secret** for their application.

Now we have Customer ABC and Customer XYZ. In theory, they’re our **client** and also the **resource owner**. We’re providing SDK for the clients so they can embed the UI in their web application or native mobile app. Or they can create their own UI and just call our API.

Based on what I read from the documentation, **client secret** is not recommended to store in native app or SPA. In this case, how can they proceed client credential flow without any backend server?

Or is it client credential flow is not even needed here? Without client credential flow, how do we protect our API from using by anonymous application? 🤔

By the way…Merry Christmas! 🎅🎄

 ![onfido](https://global.discourse-cdn.com/auth0/original/3X/6/4/64e9ba92b041267b636db8855932ae8169759be3.png)  
 ![stripe](https://global.discourse-cdn.com/auth0/original/3X/4/a/4a8bcdfb1db1c615f832a980847e502af689a104.png)  
 ![onfido-stripe](https://global.discourse-cdn.com/auth0/original/3X/5/e/5ee47b7111d4dea7066b3a513e71e0640fdd0c66.png)

---

<div class="post-metadata">

**Author:** ![stephanie.chamblee](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/stephanie.chamblee/32/26087_2.png) [@stephanie.chamblee](https://community.auth0.com/u/stephanie.chamblee)\
**Post date:** [December 31, 2020, 3:32pm UTC](https://community.auth0.com/t/onfido-stripe-client-credential-flow/55330/3 "2020-12-31T15:32:43Z")

</div>

Hi @austinchan!

Welcome to the Community and hope you had a great Christmas!

> Based on what I read from the documentation, **client secret** is not recommended to store in native app or SPA. In this case, how can they proceed client credential flow without any backend server?

That’s correct, the **Client Secret** cannot be stored in the client’s application, and so they should not use the Client Credentials flow if they are building a SPA or mobile app.

Client Credentials flow is intended for scenarios where the exchange of credentials is not exposed to the browser or third-party applications at any point during authentication (including any front-end code or other native apps on a device, etc.) This flow is appropriate if no end-user authorization is required.

Because SPAs and native apps don’t have a way to securely store their Client Secret, they must use a different flow such as [Authorization Code flow with PKCE](https://auth0.com/docs/flows/authorization-code-flow-with-proof-key-for-code-exchange-pkce). This method allows the Client to obtain an Access Token without providing a client secret.

Here is an article that explains how to determine which OAuth 2.0 flow to follow for different situations:

> **[Which OAuth 2.0 Flow Should I Use?](https://auth0.com/docs/get-started/authentication-and-authorization-flow/which-oauth-2-0-flow-should-i-use)**
>
> Learn how to identify the proper OAuth 2.0 flow for your use case.

Happy New Year!

Stephanie

---

<div class="post-metadata">

**Author:** ![austinchan](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/austinchan/32/12931_2.png) [@austinchan](https://community.auth0.com/u/austinchan)\
**Post date:** [January 1, 2021, 3:55pm UTC](https://community.auth0.com/t/onfido-stripe-client-credential-flow/55330/4 "2021-01-01T15:55:48Z")

</div>

Hi Stephanie, thanks for the reply! Given the end user authentication is not needed in this example scenario, is it none of the OAuth flow needed here? In this case, how do we protect the API from using by anonymous application that didn’t register with us?

---

<div class="post-metadata">

**Author:** ![stephanie.chamblee](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/stephanie.chamblee/32/26087_2.png) [@stephanie.chamblee](https://community.auth0.com/u/stephanie.chamblee)\
**Post date:** [January 5, 2021, 7:35pm UTC](https://community.auth0.com/t/onfido-stripe-client-credential-flow/55330/5 "2021-01-05T19:35:02Z")

</div>

Unfortunately, since end-user authentication is not required, there isn’t an available OAuth flow for this since public clients are involved.

Here is a related topic that may be helpful: [Securing anonymous asp.net core 2.0 API](https://community.auth0.com/t/securing-anonymous-asp-net-core-2-0-api/7991)

---

<div class="post-metadata">

**Author:** ![system](https://global.discourse-cdn.com/auth0/original/3X/b/5/b560f266932fcce5d57f09a6595bd50518cae3f3.jpeg) [@system](https://community.auth0.com/u/system)\
**Post date:** [January 20, 2021, 7:35pm UTC](https://community.auth0.com/t/onfido-stripe-client-credential-flow/55330/6 "2021-01-20T19:35:09Z")

</div>

This topic was automatically closed 15 days after the last reply. New replies are no longer allowed.
