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

Simple Heroku Login #86

Open
jandolina opened this issue Oct 15, 2020 · 3 comments
Open

Simple Heroku Login #86

jandolina opened this issue Oct 15, 2020 · 3 comments

Comments

@jandolina
Copy link

jandolina commented Oct 15, 2020

There are several examples of authenticating a user in Heroku in this collection, they are considerably more complex than using the web based login (heroku login). When I was using bash, prior to writing a plugin I could call "heroku login" now that I am in the SFDX Plugin framework, that is not an option. Unfortunately shelljs.exec('heroku login') just hangs when you try to open the browser, it also hangs when you supply the -i option and try to do things through the command line.

One issue with the examples, is that they are using an existing project url, I am trying to push to a project.

Is it possible to use the web login from within an sfdx plugin?
If not...
Which heroku authentication method in this library would be the best to focus on?

@mshanemc
Copy link
Owner

mshanemc commented Oct 15, 2020 via email

@jandolina
Copy link
Author

jandolina commented Oct 15, 2020

Shane,
Thank you for the reply. I have a bash script that builds a IoT Scaffold and am translating it to an SFDX plugin for ease of use and to reach a bigger audience. The scaffold makes a Connected app, a Flow, and all the supporting objects needed to run the flow. From there it spins up a Heroku server that exposes an endpoint. Heroku takes care of the Salesforce authentication so that calls to the endpoint can be made by devices who may not be able to negotiate an oauth connection.

I was able to get everything working with the Bearer token and the HEROKU_API_KEY. The only problem there is that the user had to set the credentials outside the script.

As you can expect, once that was working I found my preferred solution.
child_process.execFileSync('heroku', ['login'], {stdio: 'inherit'}); // Totally launches the browser

Thanks for the support.

@mshanemc
Copy link
Owner

mshanemc commented Oct 27, 2020 via email

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

2 participants