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,473
  • 35
  • 181
  • 253
Tim
  • 2,221
  • 6
  • 22
  • 43

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
ReyAnthonyRenacia
  • 17,219
  • 5
  • 37
  • 56