1

I am trying to generate key hash for app in which I have integrate facebook sign in

For generationg keyhash I am using code beloew as per facecook document

> C:\Program Files\Java\jdk1.8.0_111\bin> keytool -exportcert -alias androiddebugkey -keystore "C:\Users\Akash\.android \debug.keystore" |"C:\OpenSSL\bin\openssl" sha1 -binary | "C:\OpenSSL\bin\openssl" base64

but it shows me error like:

At line:1 char:97
+ ... ers\Akash\.android\debug.keystore" | "C:\OpenSSL\bin\openssl" sha1 -b ...
+                                          ~~~~~~~~~~~~~~~~~~~~~~~~
Expressions are only allowed as the first element of a pipeline.
At line:1 char:122
+ ... kash\.android\debug.keystore" | "C:\OpenSSL\bin\openssl" sha1 -binary ...
+                                                              ~~~~
Unexpected token 'sha1' in expression or statement.
At line:1 char:137
+ ... :\OpenSSL\bin\openssl" sha1 -binary | "C:\OpenSSL\bin\openssl" base64
+                                           ~~~~~~~~~~~~~~~~~~~~~~~~
Expressions are only allowed as the first element of a pipeline.
At line:1 char:162
+ ... :\OpenSSL\bin\openssl" sha1 -binary | "C:\OpenSSL\bin\openssl" base64
+                                                                    ~~~~~~
Unexpected token 'base64' in expression or statement.
    + CategoryInfo          : ParserError: (:) [], ParentContainsErrorRecordException
Bhoomi Zalavadiya
  • 689
  • 12
  • 26

3 Answers3

10

Use Command Prompt. It will work.

Muhammad Noman
  • 1,344
  • 1
  • 14
  • 28
1

use cmd and try this code below. It Worked for me

1.First download and install openssl (from git if possible)
2.set environment variable for openssl and java and try this

keytool -exportcert -alias androiddebugkey -keystore "%USERPROFILE%\.android\debug.keystore" | "openssl" sha1 -binary | "openssl" base64

If it ask for password use android

-1

Don't use the terminal inside the Visual Studio Code or Android Studio, use PowerShell or a standard Command Prompt.

Pablito
  • 521
  • 4
  • 15