# Sls login : how to login without browser?

**URL:** <https://forum.serverless.com/t/sls-login-how-to-login-without-browser/8978>\
**Category:** Serverless Framework\
**Created:** [August 2, 2019, 9:51am UTC](https://forum.serverless.com/t/sls-login-how-to-login-without-browser/8978 "2019-08-02T09:51:29Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![Patchoulin](https://avatars.discourse-cdn.com/v4/letter/p/bb73d2/32.png) [@Patchoulin](https://forum.serverless.com/u/Patchoulin)\
**Post date:** [August 2, 2019, 9:51am UTC](https://forum.serverless.com/t/sls-login-how-to-login-without-browser/8978/1 "2019-08-02T09:51:29Z")

</div>

I follow this doc to try the test capability of the serverless framework :  
[https://github.com/serverless/enterprise/blob/master/docs/testing.md](https://github.com/serverless/enterprise/blob/master/docs/testing.md)

The framework is installed on an EC2 instance. My environment is the following one :

> Your Environment Information ---------------------------  
> Operating System: linux  
> Node Version: 12.6.0  
> Serverless Version: 1.48.3  
> Enterprise Plugin Version: 1.3.2  
> Platform SDK Version: 2.0.4

The command “sls test” gives the following output :

> Serverless: Run “serverless” to configure your service for testing.

So, I run the “serverless” command, that gives me the following output :

> You can monitor, troubleshoot, and test your new service with a free Serverless account.
> 
> Serverless: Would you like to enable this? Yes
> 
> You are not logged in or you do not have a Serverless account.
> 
> Serverless: Do you want to register? No  
> If you have a Serverless account you can run “serverless login” to  
> login and then run “serverless” again to finish setup.

I already have a serverless account, so I run the command “sls login”, that gives me the following output :

> Serverless: Logging you in via your default browser…

The problem is that I am on a EC2 instance, and there is no browser for opening the login page.  
But, on the github link, there are screenshots that suggest that it can be done only using the CLI.

How can I login just using the CLI ?  
If it is not possible, how can I login from an EC2 instance ?

Regards.

---

<div class="post-metadata">

**Author:** ![hastarin](https://avatars.discourse-cdn.com/v4/letter/h/a9adbd/32.png) [@hastarin](https://forum.serverless.com/u/hastarin)\
**Post date:** [August 4, 2019, 11:56pm UTC](https://forum.serverless.com/t/sls-login-how-to-login-without-browser/8978/2 "2019-08-04T23:56:12Z")

</div>

I am having a similar problem using a Visual Studio Code Remote Dev Container and came to the forums to search for this. Hopefully someone has a solution.

---

<div class="post-metadata">

**Author:** ![CoSte](https://avatars.discourse-cdn.com/v4/letter/c/77aa72/32.png) [@CoSte](https://forum.serverless.com/u/CoSte)\
**Post date:** [August 6, 2019, 3:22pm UTC](https://forum.serverless.com/t/sls-login-how-to-login-without-browser/8978/3 "2019-08-06T15:22:48Z")

</div>

same here… i am evaluating some possibilities for monitoring and it would be nice if someone could provide feedback for this problem…

---

<div class="post-metadata">

**Author:** ![ckenney](https://avatars.discourse-cdn.com/v4/letter/c/f1d935/32.png) [@ckenney](https://forum.serverless.com/u/ckenney)\
**Post date:** [August 7, 2019, 4:48pm UTC](https://forum.serverless.com/t/sls-login-how-to-login-without-browser/8978/4 "2019-08-07T16:48:46Z")

</div>

i used an environment variable of SERVERLESS\_ACCESS\_KEY with a personal access key ([https://dashboard.serverless.com/tenants/TENANT\_NAME/accessKeys](https://dashboard.serverless.com/tenants/TENANT_NAME/accessKeys)) and was able to deploy within our azure devops pipeline. i think this would work for you, but not 100% sure

---

<div class="post-metadata">

**Author:** ![Patchoulin](https://avatars.discourse-cdn.com/v4/letter/p/bb73d2/32.png) [@Patchoulin](https://forum.serverless.com/u/Patchoulin)\
**Post date:** [August 20, 2019, 9:22am UTC](https://forum.serverless.com/t/sls-login-how-to-login-without-browser/8978/5 "2019-08-20T09:22:58Z")

</div>

I tried what you suggest, and what alexdebrie suggests in this post : [Log into Serverless Platform on a headless system](http://forum.serverless.com/t/log-into-serverless-platform-on-a-headless-system/5215)  
But I still get the message “Serverless: Logging you in via your default browser…”

What I tried :

1. create an app on my serverless account : “mysuperapp” ;
2. create a personal access key : xxxxxxxxxxxxxxx ;
3. add the following to my serverless.yml :

> ```
> tenant: mytenantname
> app: mysuperapp
> [...]
> environment:
> SERVERLESS_ACCESS_KEY: xxxxxxxxxxxxxxx 
> 
> ```

1. then I run ‘sls login’ at the same level of my serverless.yml, and get the message “Serverless: Logging you in via your default browser…”.

Is there something wrong ?

---

<div class="post-metadata">

**Author:** ![garethmcc](https://yyz2.discourse-cdn.com/flex036/user_avatar/forum.serverless.com/garethmcc/32/2276_2.png) [@garethmcc](https://forum.serverless.com/u/garethmcc)\
**Post date:** [August 20, 2019, 9:47am UTC](https://forum.serverless.com/t/sls-login-how-to-login-without-browser/8978/6 "2019-08-20T09:47:00Z")

</div>

Hi Patchoulin. The environment variables that needs to be set is not in serverless.yml but in the environment where serverless deploy is run for your CI/CD system. You then will not need to run `sls login`

---

<div class="post-metadata">

**Author:** ![ckenney](https://avatars.discourse-cdn.com/v4/letter/c/f1d935/32.png) [@ckenney](https://forum.serverless.com/u/ckenney)\
**Post date:** [August 20, 2019, 11:22am UTC](https://forum.serverless.com/t/sls-login-how-to-login-without-browser/8978/7 "2019-08-20T11:22:55Z")

</div>

try

`export SERVERLESS_ACCESS_KEY=XXXXXXXXXX`

and then do `sls deploy`

---

<div class="post-metadata">

**Author:** ![Patchoulin](https://avatars.discourse-cdn.com/v4/letter/p/bb73d2/32.png) [@Patchoulin](https://forum.serverless.com/u/Patchoulin)\
**Post date:** [August 20, 2019, 11:48am UTC](https://forum.serverless.com/t/sls-login-how-to-login-without-browser/8978/8 "2019-08-20T11:48:22Z")

</div>

Thank you for your help, it works! 🙂

---

<div class="post-metadata">

**Author:** ![JJJH](https://avatars.discourse-cdn.com/v4/letter/j/f07891/32.png) [@JJJH](https://forum.serverless.com/u/JJJH)\
**Post date:** [April 26, 2021, 7:52pm UTC](https://forum.serverless.com/t/sls-login-how-to-login-without-browser/8978/9 "2021-04-26T19:52:35Z")

</div>

I am having the same issue - I have set the SERVERLESS\_ACCESS\_KE in my CI/CD environment, yet I am still getting this error

> Authentication failed. - Please contact support and provide this identifier to reference this issue

I am using my personal access key. Any ideas?

Thanks.
