Sign-on by using Google OAuth2
Sign-on by using Google OAuth2
Popular OAuth2 services are available in mobile applications. such as; Login the mobile applications by using Facebook, Google, Twitter etc accounts.
In this post, I am gonna explain how to Login a mobile application by using Gmail/Google+ credentials.
Step 1: First, we should get the SHA1 fingerprint id from our Android Studio.
So, Open the terminal in Mac or Linux (In Windows, open your DOS or command prompt) then follow those below steps in a sequential order.
cd ~/.android
then
keytool -list -v -keystore ~/.android/debug.keystore -alias androiddebugkey -storepass android -keypass android
.
.
Certificate fingerprints:
MD5: B3:13:5C:40:63:7B:54:2C:95:57:24:1B:A2:CC:D7:C8
SHA1: 2C:32:8D:E3:B2:B1:33:D3:25:C2:35:F6:96:71:2C:48:98:39:98:2B
SHA256: 9D:00:90:01:31:F9:77:8C:00:F1:3C:74:C6:1B:72:0F:3A:B3:93:6A:6E:F1:F3:0E:64:0F:A5:01:76:F0:63:70
Signature algorithm name: SHA256withRSA
Version: 3
.
.
- Create a project - Project id should be a unique id.
- Go to API manager by developer console left navigation or APIs & auth link -> APIs
- Enable Google+ API by clicking Google+ link
- Follow all steps by seeing below screenshots.
Then, OAuth 2.0 Client ID
Perform create button
Your package has been successfully registered with Google API service by your SHA1 key.
Get a sample code from below GitHub URL.
GitHub: https://github.com/RanjithSubraman/OAuth2ByGmail
Comments
Post a Comment