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

[Feature Request] Support for Account-Level API Tokens for authenticating Railway CLI #538

Closed
aryanprince opened this issue Aug 20, 2024 · 3 comments

Comments

@aryanprince
Copy link

Summary

The Railway CLI currently only supports project-level API tokens for authentication but does not support account-level API tokens. Adding support for account-level tokens would enable integration with tools like the 1Password Shell Plugin, allowing for easy (and secure) authentication across multiple projects when using the CLI locally.

What's the problem

When using a project-level API token, commands like the following work as expected:

RAILWAY_TOKEN="my_project_level_api_token" railway run

However, the CLI does not support account-level API tokens. If attempted:

RAILWAY_TOKEN="my_account_level_api_token" railway run

The command fails, limiting authentication to single-project tokens only.

Potential solution

Allow the Railway CLI to accept account-level API tokens, so commands like:

RAILWAY_TOKEN="my_account_level_api_token" railway whoami
# or
RAILWAY__ACCOUNT_TOKEN="my_account_level_api_token" railway whoami

return the user’s account details! ✨

Reference

This feature would improve compatibility with tools like 1Password's CLI Shell Plugin. See the related issue on 1Password's open-source shell plugin repo here.

@brody192
Copy link
Contributor

Unless I'm massively misunderstanding your feature request.. The CLI already supports using an account token via RAILWAY_API_TOKEN

https://github.com/railwayapp/cli/blob/master/src/config.rs#L115

@aryanprince
Copy link
Author

@brody192 Thanks man, this is exactly what I was looking for! 💯

Perhaps the official documentation could be updated here to mention that an account-level token could be passed on as RAILWAY_API_TOKEN since I couldn't find this info anywhere else.

@brody192
Copy link
Contributor

Good callout, I will get that docs section updated so that it mentions an account token too!

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