Gaurav Mall
Gaurav Mall

Reputation: 502

BitBucket Cloud's Oauth implicit grant method stopped working in electron app

I was using BitBucket Cloud's Oauth implicit grant method in my electron app for authenticating my app to fetch the details of my repositories.

It stopped working recently.

Reference link of implicit grant method:
https://bitbucket.org/atlassian/bb-cloud-implicit-grant-sample-app/src/master/

I noticed that even if I directly open login page its not working. Here is the code example:

let win = new remote.BrowserWindow({ width: 800, height: 600, show:false, webPreferences: {sandbox: true, }});
win.loadURL('https://id.atlassian.com/login'); // this stopped working

Any idea why?

Upvotes: 2

Views: 115

Answers (1)

Gaurav Mall
Gaurav Mall

Reputation: 502

As a workaround I've fixed the issue and its not a blocker anymore.

Solution By navigating the user to actual browser instead of in-app browser (to authorize where id.atlassian.com is not restricted and works) and then via redirect url configuration in Bitbucket, returning the user back to the app to authenticate the app with token for further processing.

Instead of using below code in my electron app

win.loadURL('https://bitbucket.org/site/oauth2/authorize?client_id={CLIENT_ID}&response_type=token')

I've used

shell.openExternal('https://bitbucket.org/site/oauth2/authorize?client_id={CLIENT_ID}&response_type=token');

Impact The user flow is bit different, because now user will move from app to browser and then browser to app with token. Earlier everything was happening within the App.

Upvotes: 1

Related Questions