# Recommended Android Native Authentication and API Access methods clarification

**URL:** <https://community.auth0.com/t/recommended-android-native-authentication-and-api-access-methods-clarification/9467>\
**Category:** Get Help\
**Tags:** android, pkce, authentication, native\
**Created:** [February 12, 2018, 7:17am UTC](https://community.auth0.com/t/recommended-android-native-authentication-and-api-access-methods-clarification/9467 "2018-02-12T07:17:50Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![amalycky](https://upload.wikimedia.org/wikipedia/commons/thumb/7/7c/User_font_awesome.svg/768px-User_font_awesome.svg.png) [@amalycky](https://community.auth0.com/u/amalycky)\
**Post date:** [February 12, 2018, 7:17am UTC](https://community.auth0.com/t/recommended-android-native-authentication-and-api-access-methods-clarification/9467/1 "2018-02-12T07:17:50Z")

</div>

Can I get some clarification on the following  
I have an Android native client, initially I did a POC with embedded lock for authentication. By the time I got around to wanting to flesh out my logon/token/refresh life cycle the recommendations had changed to browser based authentication as per this link:

> **[Auth0.Android - Auth0 Docs](https://auth0.com/docs/libraries/auth0-android)**
>
> Learn how to install, initialize, and use Auth0.Android

so I used the Auth0 Android SDK for java and implemented as directed, this is now working pretty much exactly how I want in my client.

But I see now the recommendation is for PKCE grant-type authentication when using native mobile to then access an API as per these two links:

> **[Authorization Code Flow with Proof Key for Code Exchange (PKCE) - Auth0 Docs](https://auth0.com/docs/get-started/authentication-and-authorization-flow/authorization-code-flow-with-pkce)**
>
> Learn how the Authorization Code flow with Proof Key for Code Exchange (PKCE) works and why you should use it for native and mobile apps.

> **[Call Your API Using the Authorization Code Flow with PKCE - Auth0 Docs](https://auth0.com/docs/get-started/authentication-and-authorization-flow/authorization-code-flow-with-pkce/call-your-api-using-the-authorization-code-flow-with-pkce)**
>
> Learn how to call your API from a native, mobile, or single-page application using the Authorization Code flow using Proof Key for Code Exchange (PKCE).

saying this is more secure

So should i switch to PKCE or remain as per the previous best practice, what is the better approach to take?  
thanks

---

<div class="post-metadata">

**Author:** ![ricardo.batista](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/ricardo.batista/32/7711_2.png) [@ricardo.batista](https://community.auth0.com/u/ricardo.batista)\
**Post date:** [February 12, 2018, 10:57pm UTC](https://community.auth0.com/t/recommended-android-native-authentication-and-api-access-methods-clarification/9467/2 "2018-02-12T22:57:54Z")

</div>

I understand it may be confusing as the recommendations do change over time, but when trying to make the flows as secure as possible, we need to keep up with the latest security practices. If you’re [authenticating with the Hosted Login Page] ([GitHub - auth0/Auth0.Android: Android toolkit for Auth0 API](https://github.com/auth0/Auth0.Android#authentication-with-hosted-login-page)) through `WebAuthProvider.init`, you don’t need to switch over. With this browser based authentication, we are following the recommendations of the Internet Engineering Task Force (IETF), who has recently release a [Best Current Practices (BCP) when using OAuth 2.0 with native mobile applications] ([https://www.rfc-editor.org/rfc/rfc8252.txt](https://www.rfc-editor.org/rfc/rfc8252.txt)) where it states that `OAuth 2.0 authorization requests from native apps should only be made through external user-agents, primarily the user's browser.`

You can read more about this recommendation here:  
  
[OAuth 2.0 Best Practices for Native Apps](https://auth0.com/blog/oauth-2-best-practices-for-native-apps/)   
  
[https://www.rfc-editor.org/rfc/rfc8252.txt](https://www.rfc-editor.org/rfc/rfc8252.txt)   
  
[Mobile Device Login Flow Best Practices](https://auth0.com/docs/design/browser-based-vs-native-experience-on-mobile)

---

<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:** [August 27, 2019, 10:31am UTC](https://community.auth0.com/t/recommended-android-native-authentication-and-api-access-methods-clarification/9467/3 "2019-08-27T10:31:25Z")

</div>

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