How to generate an OAuth nonce in android?

To generate a OAuth nonce in android I tried -

                byte[] nonce = new byte[16];

                try {
                    rand = SecureRandom.getInstance("SHA1PRNG");
                } catch (NoSuchAlgorithmException e) {

                String oauth_nonce = rand.toString();

                Log.d("nonce value", oauth_nonce);

It gives something like -

Is this the correct way to generate a nonce ? If no, can you suggest a correct way ?


You can try with this

import java.util.UUID;

String nonce = UUID.randomUUID().toString();

Need Your Help

java cannot refer to non-final variable

java class gwt

The following code continues to give me:

Changes were not reflecting into the database if I perform any database operation via Signalr hub class

c# kendo-ui signalr

I am developing ASP.NET MVC application using entity framework and for data access i am following unitofwork and repository pattern. For UI, I am using kendo.