# Plotly sign in failure using Python

**URL:** <https://community.plotly.com/t/plotly-sign-in-failure-using-python/22781>\
**Category:** 📊 Plotly Python\
**Created:** [April 26, 2019, 3:30pm UTC](https://community.plotly.com/t/plotly-sign-in-failure-using-python/22781 "2019-04-26T15:30:57Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![curtburk](https://avatars.discourse-cdn.com/v4/letter/c/f19dbf/32.png) [@curtburk](https://community.plotly.com/u/curtburk)\
**Post date:** [April 26, 2019, 3:30pm UTC](https://community.plotly.com/t/plotly-sign-in-failure-using-python/22781/1 "2019-04-26T15:30:57Z")

</div>

I am new to Plotly and I am attempting to create a basic graph from the documentation provided on the Plotly site, but when I run my script within Spyder (3.3.1) I get the error message “PlotlyError: Sign in failed.”. I am using my username and api key from the .credentials file, so I am unsure of where to go next. Any help would be greatly appreciated.

```auto
import plotly 
import plotly.plotly as py
import plotly.graph_objs as go

#get plotly credentials and store in list
plty_creds = list(py.get_credentials().values())
plotly.tools.set_credentials_file(username = plty_creds[0], api_key = plty_creds[1])

trace0 = go.Scatter(
    x=[1, 2, 3, 4],
    y=[10, 15, 13, 17]
)
trace1 = go.Scatter(
    x=[1, 2, 3, 4],
    y=[16, 5, 11, 9]
)
data = [trace0, trace1]

py.sign_in(username = plty_creds[0], api_key = plty_creds[1])

py.plot(data, filename = 'basic-line', auto_open = True)

```

---

<div class="post-metadata">

**Author:** ![michaelbabyn](https://sea2.discourse-cdn.com/flex024/user_avatar/community.plotly.com/michaelbabyn/32/3569_2.png) [@michaelbabyn](https://community.plotly.com/u/michaelbabyn)\
**Post date:** [April 26, 2019, 6:39pm UTC](https://community.plotly.com/t/plotly-sign-in-failure-using-python/22781/2 "2019-04-26T18:39:59Z")

</div>

@curtburk

If you’ve set the credentials file already then you shouldn’t need to use `py.sign_in` so omitting that line shouldn’t cause you any problems. That function is for if you are working in an environment where you don’t want to write your credentials to a file (e.g a jupyter notebook hosted on server).

Also, once you have set your credentials file once, you don’t need to do it again. So

```auto
plotly.tools.set_credentials_file(username = plty_creds[0], api_key = plty_creds[1])

```

is also not necessary.

Finally, `py.get_credentials()` returns a dictionary so it would be easier and more reliable to use something like

```python
creds = py.get_credentials()
username = creds['username']
api_key = creds['api_key']

```

since d.values() won’t always return values in the order you expect (in my case `plty_creds[1]` was an empty list not my api\_key).

---

<div class="post-metadata">

**Author:** ![curtburk](https://avatars.discourse-cdn.com/v4/letter/c/f19dbf/32.png) [@curtburk](https://community.plotly.com/u/curtburk)\
**Post date:** [April 26, 2019, 7:11pm UTC](https://community.plotly.com/t/plotly-sign-in-failure-using-python/22781/3 "2019-04-26T19:11:17Z")

</div>

Thank you for the suggestions Michael, if I comment out the py\_sign.in() line I get a different error that states “PlotlyRequestError: No message”. There is some additional output, but the stated error message is the final line of the output. Do you have any insight into what might be happening?

---

<div class="post-metadata">

**Author:** ![michaelbabyn](https://sea2.discourse-cdn.com/flex024/user_avatar/community.plotly.com/michaelbabyn/32/3569_2.png) [@michaelbabyn](https://community.plotly.com/u/michaelbabyn)\
**Post date:** [April 26, 2019, 8:26pm UTC](https://community.plotly.com/t/plotly-sign-in-failure-using-python/22781/4 "2019-04-26T20:26:53Z")

</div>

@curtburk, it’s possible that your config file got messed up. Running

```auto
plotly.tools.set_config_file(**plotly.tools.get_config_defaults())

```

will reset it to the default values.

---

<div class="post-metadata">

**Author:** ![curtburk](https://avatars.discourse-cdn.com/v4/letter/c/f19dbf/32.png) [@curtburk](https://community.plotly.com/u/curtburk)\
**Post date:** [April 29, 2019, 12:27pm UTC](https://community.plotly.com/t/plotly-sign-in-failure-using-python/22781/5 "2019-04-29T12:27:50Z")

</div>

hello @michaelbabyn, I have implemented your suggestion, but still coming into the same problem. This is a complete shot in the dark, but could all of this be related to corporate firewall settings? I am working on my work computer so I don’t know if this could be a problem.

---

<div class="post-metadata">

**Author:** ![curtburk](https://avatars.discourse-cdn.com/v4/letter/c/f19dbf/32.png) [@curtburk](https://community.plotly.com/u/curtburk)\
**Post date:** [April 29, 2019, 12:49pm UTC](https://community.plotly.com/t/plotly-sign-in-failure-using-python/22781/6 "2019-04-29T12:49:00Z")

</div>

As an aside I can you offline mode to plot the data
