Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,7 @@ Although OAuthKit will automatically try to load the `oauth.json` file found ins
## OAuth Providers
* [Github](https://docs.github.com/en/apps/oauth-apps/building-oauth-apps/authorizing-oauth-apps)
* [Google](https://developers.google.com/identity/protocols/oauth2)
* **Important**: When creating a Google OAuth2 application from the [Google API Console](https://console.developers.google.com/) create an OAuth 2.0 Client type of Web Application (not iOS).
* [Instagram](https://developers.facebook.com/docs/instagram-basic-display-api/guides/getting-access-tokens-and-permissions)
* [Microsoft](https://learn.microsoft.com/en-us/entra/identity-platform/v2-oauth2-auth-code-flow)
* [Slack](https://api.slack.com/authentication/oauth-v2)
Expand Down
1 change: 1 addition & 0 deletions Sources/OAuthKit/OAuth.swift
Original file line number Diff line number Diff line change
Expand Up @@ -406,6 +406,7 @@ public extension OAuth {
queryItems.append(URLQueryItem(name: "client_secret", value: provider.clientSecret))
queryItems.append(URLQueryItem(name: "code", value: code))
queryItems.append(URLQueryItem(name: "redirect_uri", value: provider.redirectURI))
queryItems.append(URLQueryItem(name: "grant_type", value: "authorization_code"))
urlComponents.queryItems = queryItems
guard let url = urlComponents.url else {
publish(state: .empty)
Expand Down
14 changes: 14 additions & 0 deletions Tests/OAuthKitTests/Resources/oauth.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,19 @@
"user",
"repo"
]
},
{
"id": "Google",
"authorizationURL": "https://accounts.google.com/o/oauth2/v2/auth",
"accessTokenURL": "https://oauth2.googleapis.com/token",
"clientID": "CLIENT_ID",
"clientSecret": "CLIENT_SECRET",
"redirectURI": "https://github.com/codefiesta/",
"scope": [
"https://www.googleapis.com/auth/userinfo.email",
"https://www.googleapis.com/auth/userinfo.profile",
"openid"
]
}

]