0

What I need to know is a way to get SHA1 fingerprint and package name to autenticate an user via API, like this:

`

void main(){
  
postMethod(Uri url, {required Map<String, dynamic> header}){}  
getAppSha1Fingerprint(){}
  
  
    var sha1 = getAppSha1Fingerprint();
    var response = postMethod(
        Uri.parse('some url'),
        header: {
           'sha1': sha1
        },
    );
}

`

I'm not pretending to get sha1 fingerprint via console to save it in Firebase. I want to know how firebase receives the sha1 when an app make a request from his API.

ps: I've found this turorial on how to do this in java. I'm not experienced in java programming and in making Method Channel things but if there is no code in dart then I'll be veeery happy in try:

tutorial

Thank You!

I tried to search for it but the only thing I got was how to get sha1 fingerprint BEFORE app compile

1 Answers1

0

For the package name, you can use the below plugin.

https://pub.dev/packages/package_info_plus

About the sha1 key, I think you can try to add your certificate file in the app_name/assets/ folder, and then load the file using AssetBundle class.

Official Documentation - https://api.flutter.dev/flutter/services/AssetBundle-class.html

Good example of loading JSON file - https://stackoverflow.com/a/51005064/11943995