When the server authorizes a third party, the party applying for API authorization usually needs to obtain the APPKEY and APPSecret. which algorithms are generally generated based on? If you can, the sample code is better. thank you!
When the server authorizes a third party, the party applying for API authorization usually needs to obtain the APPKEY and APPSecret. which algorithms are generally generated based on? If you can, the sample code is better. thank you!
Reply content:
When the server authorizes a third party, the party applying for API authorization usually needs to obtain the APPKEY and APPSecret. which algorithms are generally generated based on? If you can, the sample code is better. thank you!
Generally, the key and secret of long numbers and letters are generated by md5 and sha1 encryption algorithms.
(Of course, it can also be completely randomly generated, with another uuid algorithm)
The original data may be the id of your account, and the unique value such as the registration time can be combined and then generated through md5 and sha1,
Compared with sha1, md5 is faster than sha1, but sha1 is more powerful than md5. Therefore, in such authorization applications, the sha1 algorithm, such as the oauth signature algorithm, is usually used.
Why does appkey and appsecret ensure the authorization is successful?
For example, if you want to pass three parameters ABC in communication, you need to repeat ABC and appsecret together to get a signature string, and then pass the signature string and appkey together,
In this case, the appkey is used to find the corresponding appsecret, and then the ABC parameter and the queried appsecret are used to create the same signature algorithm. if the obtained signature string is consistent, the authorization is successful.
The key in this process is the confidentiality of appsecret.