SwiftDiscord icon indicating copy to clipboard operation
SwiftDiscord copied to clipboard

Support for Oauth?

Open Stunner opened this issue 8 years ago • 5 comments

Was wondering if there is any support for Oauth2 namely, Implicit Grant, or ideally, Authorization Code Grant?

If not:

  • Are there plans to support any of these?
  • Would you be open to me (eventually) adding in this support?

Stunner avatar Sep 30 '17 02:09 Stunner

I think OAuth2 flow is generally outside the scope of a client lib. Once you have a JWT from an OAuth session you can use it in the client with the Bearer prefix though. And there are some enums for the different scopes.

I'm not too sure on this though, but generally OAuth stuff involves separate libraries.

nuclearace avatar Sep 30 '17 03:09 nuclearace

I'll look into this further, but I was thinking some additions to this library to make the whole sign in process with Oauth nicer. In the case for iOS, possibly provide a webview that is set to load the url required to begin the oath process. And possibly some hackery to set the redirect uri so the client may be able to intercept it and go from there.

This might warrant creating a new library just focused on the iOS platform itself, however. But I thought it would be good to bring this topic up for discussion.

Stunner avatar Sep 30 '17 03:09 Stunner

Yeah I don't really want to include iOS specific code in the lib... Mostly because iOS is kind of a pain to install atm, and there's a good chance it'll be break and stay that way for awhile before someone notices.

nuclearace avatar Sep 30 '17 03:09 nuclearace

That being said, I would probably need to see an implementation in a PR before I know if it's too hacky or scary to try and include in the lib.

nuclearace avatar Sep 30 '17 03:09 nuclearace

Fair enough, thanks for the quick reply.

Stunner avatar Sep 30 '17 03:09 Stunner