Creating User API Keys with WordPress

Creating User API Keys with WordPress

After WordCamp 2012 in San Francisco, I started to realize how many people were using WordPress as a platform for their web based application. Well with web based application come API’s and with that, unique user keys. I’ve been working on such a service lately and was in need of setting up a quick script that assigns an API Key to a user when they signup on a WordPress site. Here’s the code, and a quick explanation.

user_email . timestamp();
$user_api_key = sha1( $pre_obfu );
update_user_meta( $user_id, ‘wpcronme_user_api’, $user_api_key );
}
add_action( ‘user_register’, ‘ck_assign_api_key’ );

Ok, so what we did was hook onto the user_register hook. This passes along a user ID. From there we can get all the information we need about the newly registered user.

So, what’s the next part:

$pre_obfu = $user_id . NONCE_SALT . $user_data->user_email . timestamp();

Creating User API Keys with WordPress

We’re making a string that’s unique to this user, this site, and this timestamp (important later). When creating User API Keys the important thing is that they be unique. With WordPress this is pretty easy in that, by default, an email address can only be assigned to one account. Using the user ID and the email address as part of the hash assures we don’t get a duplicate. You may be asking about the other two parts NONCE_SALT and timestamp().

If you are following best security practices you have added unique keys and salts to your wp-config.php file right? …Right?! Go do this now if you haven’t. Now, this is a unique string to your site, meaning that unless someone else has the same key as you, they can’t replicate the exact same User API Keys.

The timestamp call does one thing and it’s very important. The first 3 items are unique, and don’t typically change. If someone’s User API Key get’s missused, you need a way for the users to recreate a new key so the previous one is invalidated. This timestamp will allow the API Key to be different if you run the same function again after a user edit, or something of the likes (I’ll leave that code up to you).

So that’s it, quickly generated unique keys for new users in WordPress. Hope this helps someone out.…

Web Design

Planning a reasonable site has an amazingly significant impact in advancing your online business on an expert level. Having a site which additionally shows up great on a cell phone or tablet is fundamental to keep on staying with your serious. To do this, your site ought to be spotless, with straightforward route, and a look and feel that is easy to follow for an improved client experience. read more about the importance of good web design at https://themesnap.com/why-a-professional-website-design-is-important/

Web architecture needs a great deal of inventiveness. An engaging plan of the site is the mystery, which will acquire loads of potential customers. A magnificent site configuration can take your association diagram higher than ever. It’s a perfect smaller plan that may fit even in little spaces and is made altogether in the United States, to ensure quality and backing.

Since you’ll be leaving the planning of your site to an organization, pick a website composition organization who utilizes the most current innovation to keep your site on head of the opposition. Aside from that you could likewise find an incredible organization which could offer security answers for your business undertaking.

Without this, another business will rapidly supplant your business. While you’re searching for the website composition organization that is generally reasonable for you, don’t neglect to audit about the association’s name, notoriety and friends approaches. It’s frequently difficult to make sure about a website architecture organization with ability in superb online business programming, it isn’t incomprehensible. So now you’ve discovered outstanding amongst other online business web composition firms.

The sites are made very easy to use. The sites are totally planned and created utilizing WordPress or comparable CMS stage and it is the ideal stage inside this field. Submitting to professional resources increment your private company site’s website streamlining (site design improvement), implying that it will be less complex for clients to find your business through web indexes.

On the off chance that you might want your site to perform and produce leads for expanded deals, your organization will require undeniably more than simply a site. In the event that you own a website yet not fulfilled, at that point it is conceivable to find support from presumed website architecture firm to dispose of same. The fascinating part about this site is it doesn’t generally follow the tides of the style world, however rather expects to gain its very own sign. It’s through getting your own site. You can do all these by getting your own site which works.

Your website is an immediate impression of your online business. At whatever point your site is prepared and open flawlessly across various cell phones, at that point your site become more noteworthy commitment medium and a more prominent pace of maintenance. In addition to the fact that this increases your private venture site’s SEO, furthermore, it stays with individuals keen on your by giving them new substance to see consistently. Submitting to nearby independent venture catalogs is another extraordinary method to showcase your private company site.

Every site is redone to their prerequisites. Numerous organizations sites have an awful situation in web index rankings, or probably won’t be recorded at all since they don’t see how web crawlers work. Moreover, keeping up your site content transfers the message that you’re staying with your methods refreshed and keeps your private venture picture cleaned, thus prevailing upon new clients.

Envision having your clients see your site, essentially to find that pieces of your site are broken. To achieve achievement, a site should be planned under the umbrella of one group. Your site is improved for web crawlers to guarantee it is straightforward for your customers to discover you. In the advanced innovation driven world, your site is frequently the absolute early introduction of your organization and need to catch the client’s consideration in a flash. A site, with quick and direct area search, was additionally a need for neighborhood business.

Rosario Berry is an expert independent essayist, as to present Mystic Web Designs. A fantastic Web Design can take your association’s business volume diagram higher than ever. It ought to be slick and clean plan which might be appropriate for even private …