Git Product home page Git Product logo

gappauth's Introduction

Hi, I'm Jonas. I like ๐Ÿง— and ๐Ÿ“š.

Currently, I work @Snowflake in the Platform team. In my spare time I ๐Ÿ‘จโ€๐Ÿ’ป stuff mostly in Go and contribute to all things Kubernetes.

You can follow me on GitHub (obviously), Twitter or bookmark my personal website ๐Ÿ˜‰.

gappauth's People

Contributors

elsesiy avatar ptsochantaris avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

gappauth's Issues

Subscribe to token change events?

I am using this in an iOS app, and need to be updated when the token is refreshed.

I see there are the GAppAuth.shared.stateChangeCallback and GAppAuth.shared.errorCallback, but I can't quit work out how to use them.

Does anyone have any pointers?

Thanks

Gareth

Support for Mac OSX?

Hi - great work - do you know if you plan to make it compatible with Mac OSX?
[!] The platform of the target `Performance Tool` (macOS 10.13) is not compatible with `GAppAuth (1.1.0)`, which does not support `osx`.

Update to latest AppAuth & GTMAppAuth SDKs

In order to ensure future compatibility the project should incorporate the latest changes made to the underlying SDKs.

Pin versions for the following SDKs:

  • GTMAppAuth 1.0.0
  • AppAuth 1.3.0

Redirection issue

when I try to login as
GAppAuth.shared.retrieveExistingAuthorizationState() if GAppAuth.shared.isAuthorized() { let authorization = GAppAuth.shared.getCurrentAuthorization() //self.updateUI(authorization) }else{ do{ try GAppAuth.shared.authorize(callback: { auth in print(auth) }) }catch{ print("error") } }
it leads to login page but after selecting the account it showd
Screen Shot 2020-01-15 at 6 26 33 PM
what could be gone wrong?

authorize callback not called

In my ViewController:

class ViewController: NSViewController {
    override func viewDidLoad() {
        super.viewDidLoad()
        do {
            try GAppAuth.shared.authorize { (success) in
                // never called
            }
        } catch {
            print(error)
        }
    }

What happens is that it pops Safari, and when I sign in with my email, it just lands me on google.com and the callback is not called. Could it be an issue with the redirect URI? Also, why it doesn't use the default browser? Is that configurable?

Thanks!

Feature request: SPM support

Thank you so much for making this brilliant project, it helped un-stick quite a few projects on macOS which were pinned down because of Google's inability to update their SDKs, and it works brilliantly.

I was wondering if you have considered adding Swift Package Manager support so we can take the "liberation" of the projects one step further and leave Cocoapods behind too ;)

Google not redirecting back to my app

Hi,

thanks for this Swift translation GTMAppAuth but I have a problem as Google is not redirecting to my app.

I've set the URL Type corresponding the reverse clientID in Info.plist. It is just that my AppDelegate application(:open:options) is not called.

The authorization endpoint has been reached and an authorisation token has been issued. I was expecting my app to be called with the redirect url, but nothing happens. I'm just back to the view controller where I called GAppAuth.shared.authorize.

I thought maybe I asked for full Gmail scope so my request has to be reviewed, but I scaled back to the default Profile and OpenId scopes and nothing happens.

I wonder if you have an idea about this problem.

Thanks again.

Swift 5 support

As Swift 5 has recently been released, the pod should be updated.

SFSafariViewController not closing when authentication is finished

Hello, I was linked to this library by you on another issue I posted.

My problem at the moment is, I am using a third-party API which uses a Google Auth system. When it finished it redirect to a url along the lines of:

https://ab.cdef.gh.ij.lmno?code=dfim34958yjsisnijq0294tj

In my Info.plist I have the following:

<key>CFBundleURLTypes</key>
	<array>
	  <dict>
	    <key>CFBundleURLSchemes</key>
	      <array>
	        <string>com.googleusercontent.apps.myid</string>
	      </array>
	  </dict>
	</array>

And in the Swift file:

fileprivate static let ClientID = "myid.apps.googleusercontent.com"
fileprivate static let RedirectURI = "https://ab.cdef.gh.ij.lmno" //Having in the form suggested caused an invalid_scheme error (or something like that)

However when auth is finished, is SFSafariViewController supposed to close? If not how would I obtain the code?

Any help is much appreciated, thanks!

invalid_grant when using hybrid flow on a Mac Catalyst app

Hi,
I use the hybrid flow to perform the Sign-in with Google on a Mac Catalyst app. I generate the authorization code on the client and exchange it on the server to obtain access and refresh token.

The redirect to the app after the sign in through custom scheme works fine and I'm able to obtain the authorization code.

@IBAction func login() {
    do {
          try GAppAuth.shared.authorize(in: self) { auth in
                if auth {
                    if GAppAuth.shared.isAuthorized() {
                        let authorization = GAppAuth.shared.getCurrentAuthorization()

                        sendAuthCodeToServer(serverAuthCode: authorization?.authState.lastAuthorizationResponse.authorizationCode, userName: authorization?.userEmail, userEmail: authorization?.userEmail)
                    }
                }
            }
        } catch let error {
            print(error.localizedDescription)
        }
}

But when I share the authorization code with my server, I get an error on the request to exchange the authentication code to obtain access_token and refresh_token.
400 {'error': 'invalid_grant', 'error_description': 'Bad Request'}

Please note that that I'm able to exchange the authorization code with access_token and refesh_token on the device.

Any ideas on what's wrong and how can I fix this?

I suspect there's something that Google libraries for login do that is not implemented in GAppAuth (see openid/AppAuth-Android#293).

SMS Authentication in Flutter

I'm unable to figure out to configure SMS Auth with FireBase (as this is the only way I use) on MacOS.

Since as of now "verifyPhoneNumber() is not available on MacOS platforms".

working with Service account

Any idea how to use Service account JSON file for authentication and then use Google Calendar API to read calendar?

Using Authorize from SwiftUI view

Hello, Firstly, Thanks @elsesiy for the brilliant work.

Secondly, Is there any way to call the GAppAuth.shared.authorize from a SwiftUI view, The current implementation requires us to pass a UIViewController for presentingViewController but, I'm building an app in SwiftUI and would love to handle the auth without adding an extra view controller just for a login button.

Also, any plans to release a new version to support the updated GTMAppAuth and AppAuth releases?

Thanks Again!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.