Closed quiKsilverItaly closed 7 years ago
Hey @quiKsilverItaly! This library is more meant to be used in the scenario where you send the access token to the backend, but in your scenario I can see how that's overkill as well.
To get the email, you could make this API call manually:
GET https://www.googleapis.com/oauth2/v3/userinfo?access_token=ACCESS_TOKEN_FROM_SIMPLICITY
It should return something like this:
{
"sub": "113934915402034538610",
"name": "Edward Jiang",
"given_name": "Edward",
"family_name": "Jiang",
"profile": "https://plus.google.com/113934915402034538610",
"picture": "https://lh6.googleusercontent.com/-eOdaSp-2dHY/AAAAAAAAAAI/AAAAAAAAABU/Z8_UB6zN_4I/photo.jpg",
"email": "edward@stormpath.com",
"email_verified": true,
"gender": "male",
"locale": "en"
}
So then you should be able to parse out the email!
Make sure that you request the email
scope with Simplicity, though!
If you want to write some code for this, I'd definitely want to incorporate this into Simplicity in the future.
See https://github.com/SimplicityMobile/Simplicity/issues/15
@edjiang I used the same solution like you recommended. Please note I used the libraries Alamofire (for HTTP-Connection) and SwiftyJSON (for extracting the JSON more easily) in my code.
This solution only currently supports Google devicetokens, but the two classes can be easily expanded with Facebook devicetoken and more.
Thanks! Yeah, the code to merge into Simplicity would take a little more work (no dependencies should be used, + this should be documented), but if it works for you I'm happy! =]
Hello there, thanks for this nice library.
The Google-Login works fine. Now I want to get the E-Mail-Information out of the AccessToken. Is this possible with your library? If not, what next step do you recommend? (For example picking up another library).
The thing is, getting the E-Mail out of access token is the only functionality I need, and using other Libs seems to be way too overkill for that.
Thanks in advance.