Swiftpack.co - Package - alexfilimon/GoogleTokenProvider

GoogleTokenProvider

Library for accessing google API.

Library is a Google OAuth 2.0 realization of TokenProvider for SwiftConnection.

Integration

  1. Install GoogleTokenProvider via SPM
.package(url: "https://github.com/alexfilimon/GoogleTokenProvider"),
  1. Get Google credentials from cloud console and fill credentials file (uncommented file you can find in attachments):
{
    // your data from cloud console
    "client_id": "some_client_id",
    "client_secret": "client_secret",

    // constants
    "authorize_url": "https://accounts.google.com/o/oauth2/auth", // url for auth in google
    "token_url": "https://oauth2.googleapis.com/token", // url for getting access token
    "callback": "/google/callback" // callback for local server
}
  1. Pass GoogleTokenProvider in Connection initialization
import GoogleTokenProvider

let googleTokenProvider = try GoogleTokenProvider(
    scopes: ["https://www.googleapis.com/auth/drive"],
    credentialFilePath: "path_to_cred_path"
)
let connection = Connection(tokenProvider: googleTokenProvider)
// ...

Resources

Credentials

{
    "client_id": "some_client_id",
    "client_secret": "client_secret",
    "authorize_url": "https://accounts.google.com/o/oauth2/auth",
    "token_url": "https://oauth2.googleapis.com/token",
    "callback": "/google/callback"
}

Github

link
Stars: 0

Used By

Total: 0

Releases

Small improvements - 2020-05-26 15:27:38

  • update dependency
  • fix linux crash
  • add documentation
  • add logging
  • add support multiple token files in system

Update dependencies - 2020-05-22 15:44:38

Fix name of file with tokens - 2020-05-22 15:18:39

Fix shell func - 2020-03-31 14:43:17

First release - 2020-03-31 14:11:51