# Create a login in start()

**URL:** <https://forums.plex.tv/t/create-a-login-in-start/3307>\
**Category:** Dev/API Corner\
**Tags:** plugin-dev\
**Created:** [January 4, 2010, 5:03pm UTC](https://forums.plex.tv/t/create-a-login-in-start/3307 "2010-01-04T17:03:31Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![David\_Veld](https://avatars.discourse-cdn.com/v4/letter/d/858c86/32.png) [@David\_Veld](https://forums.plex.tv/u/David_Veld)\
**Post date:** [January 4, 2010, 5:03pm UTC](https://forums.plex.tv/t/create-a-login-in-start/3307/1 "2010-01-04T17:03:31Z")

</div>

Hey,  
  
  
  
In the plex dev site it is said that performing a login to gain access to certain content on websites should be possible, however on this forum as well as in the dev part of the plex website I cannot find ways to perform a login.   
  
So here is my question. How can I create a login that allows plex to login at a certain website and gain access to user restricted content.

---

<div class="post-metadata">

**Author:** ![jwray](https://sea1.discourse-cdn.com/plex/user_avatar/forums.plex.tv/jwray/32/99832_2.png) [@jwray](https://forums.plex.tv/u/jwray)\
**Post date:** [January 4, 2010, 5:15pm UTC](https://forums.plex.tv/t/create-a-login-in-start/3307/2 "2010-01-04T17:15:34Z")

</div>

Hi David,  
  
  
  
there’s no one mechanism since every web site deals with the differently. You need to figure out how the web site does it (url, parameters, etc) and then issue a HTTP.Request against that mechanism. Most plugins use the Preferences support to get the name and password from the user to use as parameters for the login.  
  
  
  
Jonny

---

<div class="post-metadata">

**Author:** ![sander1](https://avatars.discourse-cdn.com/v4/letter/s/4bbf92/32.png) [@sander1](https://forums.plex.tv/u/sander1)\
**Post date:** [January 6, 2010, 10:25am UTC](https://forums.plex.tv/t/create-a-login-in-start/3307/3 "2010-01-06T10:25:34Z")

</div>

The Vimeo plugin has a login, you can use that as a starting point. The idea is to check for a certain piece of information. If it’s there it means you’re logged in, if not, you’re not.

```auto

<br />
####################################################################################################<br />
<br />
def GetMyStuff(sender):<br />
  ...<br />
  ...<br />
  # See if we have any creds stored.<br />
  if not Prefs.Get('email') and not Prefs.Get('password'):<br />
    return MessageContainer(header='Logging in', message='Please enter your email and password in the preferences.')<br />
<br />
  # See if we need to log in.<br />
  xml = XML.ElementFromURL(VIMEO_URL + 'subscriptions/channels/sort:name', True, cacheTime=0)<br />
  if xml.xpath('//title')[0].text != 'Your subscriptions on Vimeo':<br />
    Login()<br />
<br />
  # Now check to see if we're logged in.<br />
  xml = XML.ElementFromURL(VIMEO_URL + 'subscriptions/channels/sort:name', True, cacheTime=0)<br />
  if xml.xpath('//title')[0].text != 'Your subscriptions on Vimeo':<br />
    return MessageContainer(header='Error logging in', message='Check your email and password in the preferences.')<br />
  else:<br />
  ...<br />
  ...<br />
  ...<br />
<br />
####################################################################################################<br />
<br />
def Login():<br />
  values = {<br />
     'sign_in[email]' : Prefs.Get('email'),<br />
     'sign_in[password]' : Prefs.Get('password')<br />
  }<br />
<br />
  x = HTTP.Request("http://www.vimeo.com/log_in", values)<br />

```

---

<div class="post-metadata">

**Author:** ![system](https://global.discourse-cdn.com/plex/original/3X/2/a/2acb9765406f63293d357b4ec509ec39aa28f2ad.png) [@system](https://forums.plex.tv/u/system)\
**Post date:** [December 20, 2019, 8:34pm UTC](https://forums.plex.tv/t/create-a-login-in-start/3307/4 "2019-12-20T20:34:54Z")

</div>

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.
