Idea

robert-raj avatar image
robert-raj Posted ·

Electron app Use OAuth 2.0 Authorization Code Flow

I need intergate  OAuth 2.0 Authorization Code Flow  in electron desktop apps.when load AuthUri in electron window ,getting an Error AssertionError

var config = {
            authUri: ' https://platform.devtest.ringcentral.com/restapi/oauth/authorize?response_type=code&client_id=xR...',
            redirectUri: ' http://localhost:8080/callback',
        }
                const electron = require('electron')
                const BrowserWindow = electron.remote.BrowserWindow;
                var loginWindow = new BrowserWindow({
                    width: 640,
                    height: 480,
                    show: false
                });
                loginWindow.loadURL(config.authUri);
                // loginWindow.webContents.openDevTools();
                loginWindow.on('closed', () => {
                    loginWindow = null;
                });
                loginWindow.show()


Thanks in Advance 
topic-default
1 |1000 characters needed characters left characters exceeded

Up to 8 attachments (including images) can be used with a maximum of 1.0 MiB each and 10.0 MiB total.

Embbnux Ji avatar image
Embbnux Ji Posted ·
Hi @Robert, you need to disable nodeIntegration on login window, and use preload to add your electron codes.

'''
const loginWindow = new BrowserWindow({
  width: 600,
  height: 680,
  webPreferences: {
    nodeIntegration: false,
    preload: path.join(__dirname, 'preload.js'),
  },
  backgroundColor: '#fcfcfc', });
loginWindow.loadURL(oAuthUri);
'''
https://github.com/embbnux/ringcentral-widget-electron/blob/master/src/main.js#L84
1 |1000 characters needed characters left characters exceeded

Up to 8 attachments (including images) can be used with a maximum of 1.0 MiB each and 10.0 MiB total.

robert-raj avatar image
robert-raj Posted ·
HI still i got same error
1 comment
1 |1000 characters needed characters left characters exceeded

Up to 8 attachments (including images) can be used with a maximum of 1.0 MiB each and 10.0 MiB total.

What is the error? Could you please paste it here?
0 Likes 0 · ·

Write a Comment

Up to 8 attachments (including images) can be used with a maximum of 1.0 MiB each and 10.0 MiB total.

Your Opinion Counts

Share your great idea, or help out by voting for other people's ideas.