How to generate key hash for facebook in flutter

Viewed 487

I am trying to generate key hash for implementing Facebook login feature in app

I am writing the following but error appears:

keytool -exportcert -alias androiddebugkey -keystore "C:\Users\Jaffs\.android\debug.keystore" | "C:\Program Files\openSSl\bin\openssl" sha1 -binary | "C:\Program Files\openSSl\bin\openssl" base64

Error:

At line:1 char:137
  • ... roid\debug.keystore" | "C:\Program Files\openSSl\bin\openssl" sha1 -b ...
  •                        ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    

Expressions are only allowed as the first element of a pipeline. At line:1 char:176

  • ... debug.keystore" | "C:\Program Files\openSSl\bin\openssl" sha1 -binary ...
  •                                                          ~~~~
    

Unexpected token 'sha1' in expression or statement. At line:1 char:191

  • ... openssl" sha1 -binary | "C:\Program Files\openSSl\bin\openssl" base64
  •                         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    

Expressions are only allowed as the first element of a pipeline. At line:1 char:230

  • ... openssl" sha1 -binary | "C:\Program Files\openSSl\bin\openssl" base64

  •                                                                ~~~~~~
    

    Unexpected token 'base64' in expression or statement.

    • CategoryInfo : ParserError: (:) [], ParentContainsErrorRecordException
    • FullyQualifiedErrorId : ExpressionsMustBeFirstInPipeline

I checked the path of OpenSSl is correct. I tried many solutions but not worked.

2 Answers

You are specifing the openssl file extension. Type .exe at the end of the openssl path.
I did that and it provided me the key.

You can try removing the double quotes ("") in your path, then adding ".\" to the first of line if needed,

Eg:

.\keytool -exportcert -alias androiddebugkey -keystore C:\Users\MyPC.android\debug.keystore | D:\OpenSSL\bin\openssl sha1 -binary | D:\OpenSSL\bin\openssl base64

Related