Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Access Token Not Received #64

Open
hablema opened this issue Dec 4, 2018 · 3 comments
Open

Access Token Not Received #64

hablema opened this issue Dec 4, 2018 · 3 comments

Comments

@hablema
Copy link

hablema commented Dec 4, 2018

The login is completed and redirection happens but the response is not received. Am I doing something wrong?

`function googleAuth() {

const options = Object.assign({
    show: false,
    width: 480,
    height: 600,
    webPreferences: {
        nodeIntegration: false,
        contextIsolation: true,
    },
})

let window = new BrowserWindow(options)
window.once("ready-to-show", () => {
    window.show()
})
window.once("closed", () => {
    window = null
})

const GoogleClientWebApp = {
    client_id: GOOGLE_CLIENT_ID,
    client_secret: GOOGLE_CLIENT_SECRET,
    redirect_uri: GOOGLE_REDIRECT_URI,
    authorize_url: "https://accounts.google.com/o/oauth2/v2/auth",
    response_type: "token",
    scope: "https://www.googleapis.com/auth/userinfo.profile",
}


const config = GoogleClientWebApp;
const provider = new OAuth2Provider(config)

provider.perform(window)
    .then(resp => {
        console.log("Response", resp)
    })
    .catch(error => console.error(error))

}`

@mironal
Copy link
Owner

mironal commented Dec 6, 2018

Thanks your question. 😄

This module uses "did-get-redirect-request" to detect OAuth 2 redirects, but this event was deleted from electron 3.0.0.
https://electronjs.org/releases#3.0.0

I plan to update this module for electron 3.0.0.

In the meantime, you can avoid this problem by using electron 2.x.x.

@mironal
Copy link
Owner

mironal commented Dec 6, 2018

@hablema Please try v3.0.0. I fixed this problem 😃 https://www.npmjs.com/package/electron-oauth-helper/v/3.0.0

@schuster19uk
Copy link

Hi there I have tried this library for mixer.com and it is not doing anything on:

debug("start OAUTH2")
return task(config, window, this.customAuthorizationRequestParameter, this.customAccessTokenRequestParameter)
.then(resp => {
this.finished = true

    if (this.userCancelError) {
      return Promise.reject(this.userCancelError)
    }

    if (resp.error) {
      return Promise.reject(resp)
    }

    return Promise.resolve(resp)
  })

I am using the following config:

const config = {
client_id: "5ca546b27d464fc8e8fc8ac42e38380c5917710bbdf9545d",
redirect_uri: "http://localhost:8081/auth/mixer2",
authorize_url: "https://mixer.com/oauth/authorize",
access_token_url: "https://mixer.com/api/v1/oauth/token",
response_type: "code",
scope: streamerScopes,
}

This doesn't seem to resolve the promises, maybe this lib does not work with www.mixer.com ???

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants