Answers.Body: <p>I don't think I'd use PHP's session for this at all, but recently posted some thoughts on a similar question here <a href="https://craftcms.stackexchange.com/a/14188/57">https://craftcms.stackexchange.com/a/14188/57</a> about using custom tokens or authorization headers to perform the authorization.</p>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2016-03-18T09:49:23.147Z
Answers.Text: Thanks Brad. I am now working on expanding the plugin with a function that creates a custom token.
Answers.UserDisplayName: Rbijker.com
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2016-03-18T22:59:33.103Z
Answers.Text: If you can share it, would love to see what you come up with when you're done!
Answers.UserDisplayName: Brad Bell
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2016-03-18T00:33:39.900Z
Answers.LastActivityDate: 2016-03-18T00:33:39.900Z
Answers.LastEditDate: 2017-04-13T12:51:00.160Z
Answers.UserDisplayName: Brad Bell
Body: <p>Is there a service method I can use to get (any kind of) session data by giving the cookies CraftSessionId as a parameter?</p>
  
  <p>if would look something like this. 
  <code>craft()-&gt;userSession-&gt;getSessionBySessionId($craftSessionId)</code></p>
  
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2016-03-17T22:29:28.673Z
Comments.Text: What are you trying to accomplish?  Are you thinking there would be multiple PHP sessions for a user?  Or are you just looking to see how to read from and write to session?
Comments.UserDisplayName: Brad Bell
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2016-03-17T22:45:07.950Z
Comments.Text: Im using the ElementAPI (https://github.com/pixelandtonic/) . I see that you wrote it. Great :-).
Comments.UserDisplayName: Rbijker.com
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2016-03-17T23:00:14.017Z
Comments.Text: So with this plugin I want to make a json API for Android and IOS apps. I want to create API urls to log the user in and authenticate the user.
Comments.UserDisplayName: Rbijker.com
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2016-03-17T23:06:03.277Z
Comments.Text: I wanted to use craft()->userSession methods for this in the API but since this uses php SESSION I thought that it will only work when you visit the page with a browser, not when making calls from Android and IOS apps. eg. craft()->userSession->isLoggedIn I dont think will work in this case (am I correct?).
  So I want to make a API url that can log the user in, and give some kind of a session id in the response. Then the device can make other api calls and include this session id so that I can authenticate each call the user makes. Is this the way to go about it? Do you have any suggestions?
Comments.UserDisplayName: Rbijker.com
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2016-07-27T00:35:36.530Z
Comments.Text: @SiteHopper I'm attempting to do exactly the same thing - I'm using the ElementAPI for a client side app and would like to authenticate api calls. Did you find a solution?
Comments.UserDisplayName: Adam Soffer
Tags: <plugin-development><craft-pro>
Title: get session data by cookies CraftSessionId
ThreadText: # get session data by cookies CraftSessionId
  
  (Asked by: username_0 on 2016-03-17)
  
  Is there a service method I can use to get (any kind of) session data by giving the cookies CraftSessionId as a parameter?
  
  if would look something like this.
  `craft()->userSession->getSessionBySessionId($craftSessionId)`
  
  **Tags:** plugin-development, craft-pro
  
  > **Comments:**
  > **username_1**: What are you trying to accomplish?  Are you thinking there would be multiple PHP sessions for a user?  Or are you just looking to see how to read from and write to session?  
  > **username_0**: Im using the ElementAPI (https://github.com/pixelandtonic/) . I see that you wrote it. Great :-).  
  > **username_0**: So with this plugin I want to make a json API for Android and IOS apps. I want to create API urls to log the user in and authenticate the user.  
  > **username_0**: I wanted to use craft()->userSession methods for this in the API but since this uses php SESSION I thought that it will only work when you visit the page with a browser, not when making calls from Android and IOS apps. eg. craft()->userSession->isLoggedIn I dont think will work in this case (am I correct?). So I want to make a API url that can log the user in, and give some kind of a session id in the response. Then the device can make other api calls and include this session id so that I can authenticate each call the user makes. Is this the way to go about it? Do you have any suggestions?  
  > **username_2**: @SiteHopper I'm attempting to do exactly the same thing - I'm using the ElementAPI for a client side app and would like to authenticate api calls. Did you find a solution?  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_1 on 2016-03-18. Score: 1
  
  I don't think I'd use PHP's session for this at all, but recently posted some thoughts on a similar question here <https://craftcms.stackexchange.com/a/14188/57> about using custom tokens or authorization headers to perform the authorization.
  
  > **Comments:**
  > **username_0**: Thanks username_1. I am now working on expanding the plugin with a function that creates a custom token.  
  > **username_1**: If you can share it, would love to see what you come up with when you're done!  
  
  ---
  
  