SimplicityMobile / Simplicity

A simple way to implement Facebook and Google login in your iOS apps.
Apache License 2.0
681 stars 66 forks source link

I have everything setup, yet calling the login function appears to do nothing. #20

Closed knakamura13 closed 7 years ago

knakamura13 commented 7 years ago

I called the function 'Simplicity.login(Google())' within my viewDidLoad() function in the ViewController.swift file.

I expected something to happen when I tried to print the accessToken within the function's scope, yet nothing happens when the code runs. There's no errors so I'd like to know what step I'm missing.

Thanks!

edjiang commented 7 years ago

Hey @chuby1tubby -- is the google login page even appearing?

You most likely need to put this in the viewDidAppear function.

knakamura13 commented 7 years ago

Oh! I'm sorry I don't know why I didn't try that first. That made the login screen appear, so thank you.

Now, does the user have to input their login credentials every single time they open my app? Or can the Google account stay logged in indefinitely?

edjiang commented 7 years ago

It's up to you for how you want to save the access token returned; Simplicity does not handle that for you. I would recommend saving it into the iOS Keychain.

edjiang commented 7 years ago

In other apps, you might want to use the Google token to log into your own server, and save your server's token instead. In that case, you can do that however you want, too =]

knakamura13 commented 7 years ago

Great. Thank you for that information! I'm super excited to use this in many apps in the future.

edjiang commented 7 years ago

No problem! Glad we could help!