0

I just started to learn Swift recently and I implemented the sample code that Google gives us to create a calendar. However, I would also like to know how to signout of an account to switch to another calendar but I can't seem to figure it out. Could someone give me some pointers?

Thanks for your help in advance! :-)

Tim

Eric Aya
  • 69,000
  • 34
  • 174
  • 243
Tim
  • 1,971
  • 3
  • 21
  • 40

1 Answers1

0

Google docs has a revoking a token guide for OAuth 2.0.

You can use request using HTTP/REST:

curl https://accounts.google.com/o/oauth2/revoke?token={token}

If you're not familiar with HTTP request in Swift, try the following guides in this thread using NSURLConnection.

let url = NSURL(string: "https://accounts.google.com/o/oauth2/revoke?token={token}")

let task = NSURLSession.sharedSession().dataTaskWithURL(url!) {(data, response, error) in
    print(NSString(data: data!, encoding: NSUTF8StringEncoding))
}

task.resume()
Community
  • 1
  • 1
noogui
  • 16,300
  • 4
  • 25
  • 51