Exemplo n.º 1
0
func ssoLogin() {
	url := os.Getenv("SSO_URL")
	if url == "" {
		org := os.Getenv("HEROKU_ORGANIZATION")
		for org == "" {
			org = getString("Enter your organization name: ")
		}
		url = "https://sso.heroku.com/saml/" + org + "/init?cli=true"
	}
	Err("Opening browser for login...")
	err := webbrowser.Open(url)
	if err != nil {
		Errln(" " + err.Error() + ".\nNavigate to " + cyan(url))
	} else {
		Errln(" done")
	}
	token := getPassword("Enter your access token (typing will be hidden): ")
	user := getUserFromToken(token)
	if user == "" {
		ExitIfError(errors.New("Access token invalid."))
	}
	saveOauthToken(user, token)
	Println("Logged in as " + cyan(user))
}
Exemplo n.º 2
0
func main() {
	webbrowser.Open("http://golang.org")
	webbrowser.Open("http://reddit.com")
}