# How to get code and code verifier in java objects?

**URL:** <https://community.auth0.com/t/how-to-get-code-and-code-verifier-in-java-objects/20501>\
**Category:** Get Help\
**Tags:** android, code-verifier, code, java\
**Created:** [January 24, 2019, 6:44pm UTC](https://community.auth0.com/t/how-to-get-code-and-code-verifier-in-java-objects/20501 "2019-01-24T18:44:40Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Naofilms](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/naofilms/32/13584_2.png) [@Naofilms](https://community.auth0.com/u/Naofilms)\
**Post date:** [January 24, 2019, 6:44pm UTC](https://community.auth0.com/t/how-to-get-code-and-code-verifier-in-java-objects/20501/1 "2019-01-24T18:44:40Z")

</div>

After successful login from social account i.e google, i get following result in console.

> D/OkHttp: {“code”:“jG-asd3df”,“redirect\_uri”: “adasd”, “code\_verifier”:“asdae3fd”}

Is there any way possible i can get these fields `code` and `code_verifier` in java objects.

The Credentials method does not have these fields.

Is there some other way to get `code` and `code_verifier`. Please guide me.

---

<div class="post-metadata">

**Author:** ![James.Morrison](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/james.morrison/32/13507_2.png) [@James.Morrison](https://community.auth0.com/u/James.Morrison)\
**Post date:** [January 24, 2019, 7:27pm UTC](https://community.auth0.com/t/how-to-get-code-and-code-verifier-in-java-objects/20501/3 "2019-01-24T19:27:35Z")

</div>

Hi there @Naofilms, this document we have on Authorization Code Grant Flow with PKCE dives into leveraging the `code` and `code_verifier`. Please let me know if this helps you in your quest or if I can help in any additional way, thanks!

[https://auth0.com/docs/api-auth/tutorials/authorization-code-grant-pkce](https://auth0.com/docs/api-auth/tutorials/authorization-code-grant-pkce)

---

<div class="post-metadata">

**Author:** ![Naofilms](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/naofilms/32/13584_2.png) [@Naofilms](https://community.auth0.com/u/Naofilms)\
**Post date:** [January 25, 2019, 11:12am UTC](https://community.auth0.com/t/how-to-get-code-and-code-verifier-in-java-objects/20501/4 "2019-01-25T11:12:01Z")

</div>

@James.Morrison Thanks for this document, i understand the process of creating `code_verifier` but i am using `AuthCallback` to initiate the request.

```
WebAuthProvider.init(auth0)
            .withScheme("com.scheme")
            .withAudience("http://aaa.aa")
            .withConnection("google-oauth2")
            .withScope("openid profile email offline_access read:current_user update:current_user_metadata")
            .start(activity, webCallback);

```

In return i get response in `Credentials` class, the credentials class does not know about `code_verifier` and `code`.

Although in logs i can see `code_verifier` and `code` received from social sign in response.

Please guide me that what should be my next step after getting response from `WebAuthProvider`, or should i need to make custom request to the browser without using `SDK` to get `code_verifier` and `code`

---

<div class="post-metadata">

**Author:** ![James.Morrison](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/james.morrison/32/13507_2.png) [@James.Morrison](https://community.auth0.com/u/James.Morrison)\
**Post date:** [January 28, 2019, 5:48pm UTC](https://community.auth0.com/t/how-to-get-code-and-code-verifier-in-java-objects/20501/5 "2019-01-28T17:48:26Z")

</div>

After checking with our team, the goal is to have the library perform the authentication and handle the PKCE flow itself. You will never receive the code and code-verifier values as those are part of the middle step. The library will handle the tokens in the Credentials object directly to you via the callback you passed on the call. Please let me know if you have any questions, thanks!

---

<div class="post-metadata">

**Author:** ![James.Morrison](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/james.morrison/32/13507_2.png) [@James.Morrison](https://community.auth0.com/u/James.Morrison)\
**Post date:** [February 12, 2019, 5:48pm UTC](https://community.auth0.com/t/how-to-get-code-and-code-verifier-in-java-objects/20501/6 "2019-02-12T17:48:30Z")

</div>

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