Non-incognito browser session
By default, saml2aws opens an incognito browser session. It would be great to specify the browser provider options to run the non-incognito session to retain cookies between the browser runs. I could create a PR with these changes, but I have not found the corresponding playwright browser launch options https://github.com/Versent/saml2aws/blob/master/pkg/provider/browser/browser.go#L32
Is the browser provider session opened as incognito on purpose, or is it the default setting of playwright package? ...
Found the way around this issue by using the Chrome browser + this extension (source) instead of the saml2aws.
I was messing around with the code a bit locally.
and found if you swap this:
launchOptions := playwright.BrowserTypeLaunchOptions{
Headless: playwright.Bool(cl.Headless),
}
to
launchOptions := playwright.BrowserTypeLaunchPersistentContextOptions{
Headless: playwright.Bool(cl.Headless),
}
and this
browser, err := browserType.Launch(launchOptions)
to
browser, err := browserType.LaunchPersistentContext("~/Library/Application Support/Google/Chrome/Default", launchOptions)
it will open chrome in a non incognito browser session, but doesnt load in your chrome profile. That should at least be a start for someone to pickup and work on this.
Note: ~/Library/Application Support/Google/Chrome/Default is the chrome data dir on chrome for mac
both
launchOptions := playwright.BrowserTypeLaunchOptions{
Headless: playwright.Bool(cl.Headless),
}
and
launchOptions := playwright.BrowserTypeLaunchPersistentContextOptions{
Headless: playwright.Bool(cl.Headless),
}
let you pass in chrome args: https://peter.sh/experiments/chromium-command-line-switches/
launchOptions := playwright.BrowserTypeLaunchPersistentContextOptions{
Headless: playwright.Bool(cl.Headless),
Args: []string{"--profile-directory=Profile 2"},
}
i tried passing in a bunch of options but couldnt get it to work as you would expect in a Non-incognito browser session
My PR solves the issue: https://github.com/Versent/saml2aws/pull/1267
It still uses the private browsing window, but after first login your storageState (cookies/session-data) is re-used. I found this more reliable than trying to use playwright.BrowserTypeLaunchPersistentContextOptions