Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8786401
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T21:37:02+00:00 2026-06-13T21:37:02+00:00

Here is the situation, I have setup 2 codeigniter installation. One will be a

  • 0

Here is the situation, I have setup 2 codeigniter installation.

One will be a client and one will be an api. Further improvement of this will be

  1. The client will no longer be made from CI, since I wasn’t using it’s functionality. I just wanted to start out from a mvc framework right on.

My question would be where should I be storing sessions? during logins.

Below is how I did it, but I think I did it wrong.

  1. I created a Login from the client. This one sends the login credentials to the api and then validated these information sent by the client and will return a message/response whethere the login credentials were valid or not.

If the login details were valid, the api will set a session in it’s controller like this

if(true) {
    $this->session->set_userdata($array);
}

This is in the login_controller I created. Is this the proper way of setting sessions for a client of a api?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-13T21:37:03+00:00Added an answer on June 13, 2026 at 9:37 pm

    You’ve got the concept right. You only want to set session userdata upon verifying the user supplied valid credentials.

    That said, make sure you’re using encrypted cookies and, if you’re handling sensitive data, store your session data in the database. Storing it in the database causes some odd quirks with how sessions work in CodeIgniter (mainly with flashdata), but the added benefit of positive identification might potentially be worth it.

    By storing the session data in the database, you can more positively verify a user is who they claim to be (in terms of the session ID, etc). The reason is because the session data is stored only in the database, and not in the session cookie (which only holds session ID and some other info). That way, even if someone does manage to decrypt the cookie, they can’t modify their userdata to pretend to be someone else, like you might be able to with the cookies only method.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

We have a weird situation going on here. We have setup a local installation
Here is my situation: I will have one frontend server running Nginx, and multiple
Here is my situation: I have one table that contains a list of drugs
Here's the situation I have a webpage which has one drop down called prefer.
Here is the situation: You have one long-running calculation running in a background thread.
OK, this is impossible, but I will try to explain the situation here. Let's
So, here's my situation : I have a complete app set up with CodeIgniter.
Here is the situation. I have a view controller titled MyViewController. Within this view
I have a situation here. I have a redundant TCP server setup which takes
here is the situation: i have one machine which lives at my house (lets

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.