<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: marvelken</title>
    <description>The latest articles on DEV Community by marvelken (@marvelken).</description>
    <link>https://dev.to/marvelken</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F707582%2Fa99e1f9d-f7ae-484b-8ea0-f9d851cecea0.png</url>
      <title>DEV Community: marvelken</title>
      <link>https://dev.to/marvelken</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/marvelken"/>
    <language>en</language>
    <item>
      <title>Five flutter projects to participate in hackoctober</title>
      <dc:creator>marvelken</dc:creator>
      <pubDate>Sat, 29 Oct 2022 23:27:39 +0000</pubDate>
      <link>https://dev.to/marvelken/five-flutter-projects-to-participate-in-hackoctober-364i</link>
      <guid>https://dev.to/marvelken/five-flutter-projects-to-participate-in-hackoctober-364i</guid>
      <description>&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--0--p8V0s--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/2laap3z5onr4otav606k.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--0--p8V0s--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/2laap3z5onr4otav606k.png" alt="Image description" width="880" height="495"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Introduction
&lt;/h2&gt;

&lt;p&gt;DigitalOcean sponsors Hacktoberfest, a month-long festival honoring open-source software that promotes involvement in giving back to the open-source community. Developers participate by completing pull requests, attending events, and making financial contributions to open-source projects.&lt;/p&gt;

&lt;h2&gt;
  
  
  Goals
&lt;/h2&gt;

&lt;p&gt;Hacktoberfest is one of the most well-known events that promote contributions to open source. In this blog, I'll go through every facet of Hacktoberfest as well as resources for connecting with repos for contributions.&lt;br&gt;
This essay will explore the importance of Hacktoberfest for developers as well as five fantastic flutter projects that might help developers feel heard and pleased.&lt;/p&gt;

&lt;h2&gt;
  
  
  Flutter Repos to contribute to hackoctober fest
&lt;/h2&gt;

&lt;p&gt;This page contains links to over 300 &lt;a href="https://github.com/search?l=Dart&amp;amp;o=desc&amp;amp;p=1&amp;amp;q=topic:hacktoberfest&amp;amp;s=updated&amp;amp;type=Repositories"&gt;flutter repos&lt;/a&gt; to which you can contribute, however, the five listed below were chosen because they assist novice and experienced flutter developers in gaining access to the full scope of flutter development expertise, strengthening your weak hands in open-source and not only a test for T-shirts.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://github.com/fluttercommunity"&gt;&lt;strong&gt;Flutter community&lt;/strong&gt;&lt;/a&gt;&lt;strong&gt;:&lt;/strong&gt; &lt;br&gt;
The majority of the flutter packages in this group are used by all flutter applications. This project is mostly for skilled Flutter developers with experience.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://github.com/flame-engine/flame"&gt;&lt;strong&gt;Flame-engine&lt;/strong&gt;&lt;/a&gt;:&lt;br&gt;
Flame is a Flutter game engine that is modular and offers a full range of convenient solutions for games. It benefits from the robust infrastructure. This project is mostly for skilled Flutter developers with experience.&lt;/p&gt;




&lt;p&gt;&lt;a href="https://github.com/Clueless-Community"&gt;&lt;strong&gt;Clueless community&lt;/strong&gt;&lt;/a&gt;:&lt;br&gt;
With PREGA and flutter-UI-components being the Flutter repos that are appropriate for new Flutter developers to contribute to and acquire the sense of open-source contribution, the Clueless community has several excellent repositories. This project is mostly for skilled and intermediary Flutter developers.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://github.com/aadityaagrawal/Institute-ID-Card"&gt;&lt;strong&gt;Institute ID card&lt;/strong&gt;&lt;/a&gt;:&lt;br&gt;
A straightforward Flutter generator for creating college ID cards that keeps your information for later usage in the Firestore database. This project is mostly for beginners and intermediary Flutter developers.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://github.com/tanmoy27112000/flutter_web_base"&gt;&lt;strong&gt;Flutter web base&lt;/strong&gt;&lt;/a&gt;&lt;br&gt;
Flutter web base is a project that aims to be a UI element library for Flutter web similar to Bootstrap but Flutter.,&lt;/p&gt;

&lt;h2&gt;
  
  
  Avoid making it spam-Octoberfest
&lt;/h2&gt;

&lt;p&gt;According to Digital Ocean there are regulations in place to lessen spam. The excitement of obtaining a limited-edition Hacktoberfest t-shirt and the growing popularity of the event were determined to be the cause of low-quality pull/merge requests (PR/MRs) in 2020 as participants chased the t-shirt without considering their actions. These acts caused the open-source community to have a worse experience and added work for maintainers. As a result, Digital Ocean tightened the guidelines for submissions for the 2020 event right away and improved the consistency of enforcement, thus ensuring higher-quality PR/MRs and lowering the number of spam complaints. This year's rules are unchanged, and they will continue to be improved based on community feedback to ensure that Hacktoberfest is a success.&lt;/p&gt;

&lt;p&gt;The following guidelines are drafted for this year as part of the ongoing commitment to high-quality contributions and useful experiences that unite the open-source community:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Maintainers must choose to participate in Hacktoberfest by either adding the "hacktoberfest" topic to their participating repository/project in GitHub or GitLab, or by adding the "hacktoberfest-accepted" label to certain PRs/MRs.&lt;/li&gt;
&lt;li&gt;Spam PR/MRs will be marked as such. The PR/MR will be considered spam and not count toward Hacktoberfest if any of its labels contain the word "spam." Two or more spam PRs or MRs will result in a user's permanent disqualification.&lt;/li&gt;
&lt;li&gt;PRs and MRs only count after a maintainer accepts them. By merging them, giving them a general thumbs up, or marking them as "hacktoberfest-accepted," maintainers of opted-in projects can accept PR/MRs from contributors.&lt;/li&gt;
&lt;li&gt;A system for reporting problematic repositories has been implemented. The Hacktoberfest community can alert Digita ocean about repositories intended to rig the competition.&lt;/li&gt;
&lt;li&gt;The importance of getting a t-shirt and earning a prize has been diminished. Instead there is more concentration on how to unite communities to enhance open source for everyone.
## Guidelines to create a good PR&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Create a good Repo with the following guidelines below;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Pick a solid repo.&lt;/li&gt;
&lt;li&gt;To commit your modifications, fork the repository.&lt;/li&gt;
&lt;li&gt;To post all changes without affecting the original repository, forks essentially make a replica of the same repository on your account.&lt;/li&gt;
&lt;li&gt;Make a new branch based on your work. For instance, to work on a drag-n-drop feature for marvel-ken.&lt;/li&gt;
&lt;li&gt;You will be able to see a contribute button in your forked GitHub project once the job is finished. Utilize it to produce a PR for the main repository.&lt;/li&gt;
&lt;li&gt;Watch for the PR's approval. You can always add new code to the branch and update the PR if there are any problems with the PR. After merging, at this point you are successful in adding to an open-source repository.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Final thoughts
&lt;/h2&gt;

&lt;p&gt;Since the annual festival still has a few days left before it ends on October 31st, there is still time to participate. In this article, we went over the dos and don'ts of the fest and highlighted five excellent repos to contribute to. I have concluded this essay; I appreciate your patience.&lt;/p&gt;

</description>
    </item>
    <item>
      <title>HIGH-PERFORMANCE GRAPHICS WITH REACT NATIVE SKIA</title>
      <dc:creator>marvelken</dc:creator>
      <pubDate>Fri, 18 Feb 2022 18:53:00 +0000</pubDate>
      <link>https://dev.to/marvelken/high-performance-graphics-with-react-native-skia-2al9</link>
      <guid>https://dev.to/marvelken/high-performance-graphics-with-react-native-skia-2al9</guid>
      <description>&lt;h1&gt;
  
  
  Goals
&lt;/h1&gt;

&lt;p&gt;React native SKIA still in alpha and this article will only cover the benefits of skia to React Native developers.&lt;/p&gt;

&lt;h1&gt;
  
  
  Introduction;-
&lt;/h1&gt;

&lt;blockquote&gt;
&lt;p&gt;React Native SKIA would be able to integrate the SKIA library into React Native, which would make many challenging and impossible React Native tasks much easier. I think i would point out the fact that this is my first article without any code, I was uneasy at first but pretty fine writing.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;In react native, graphics have been a pain in the neck. I must say that SKIA represents a significant innovation. With SKIA, it only takes a few lines of code to produce amazing visuals; producing stunning and professional-looking applications would no longer require a large amount of code.&lt;/p&gt;

&lt;p&gt;One of Facebook's self-proclaimed biggest mistakes was believing so much in HTML over NATIVE, well you could ask why? Retrieving data on a mobile version of Facebook was slow and at the same time unstable. React-Native was created as a result of this.&lt;/p&gt;

&lt;p&gt;It allows developers to freely use the React framework in accordance with native enablements or capabilities when developing for Android, iOS, and Windows, although React-Native has a number of limitations. The React-Native Skia library comes into play here.&lt;/p&gt;

&lt;p&gt;Since React Native SKIA is currently in alpha, we would have to wait for its full production before using it to construct something distinctive and sophisticated at the same time. But what does the React-Native Skia library have to offer the React-Native development environment before that happens? This article elaborates on that.&lt;/p&gt;

&lt;h2&gt;
  
  
  Do you want to try it before its release? You can follow the steps below:
&lt;/h2&gt;

&lt;p&gt;Let's set up a development area for React Native, since React Native Skia project was recently focused on Ubuntu 18 to speed up project development, during your set up of React Native development areas you may encounter a KVM error while trying to run AVD in Android studio, there are quick fixes out there and you can also try this:&lt;br&gt;
Open your Terminal&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Sudo apt install qemu-kvm and run this
Add user "username" kvm replace "username" with your name and run this
Restart pc
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;Hope this turns out just fine for you, if this doesn't work out simply contact Ubuntu developers to help you out.&lt;br&gt;
We would need to install REACT NATIVE SKIA but then I wouldn't go into that as &lt;a href="https://shopify.github.io/react-native-skia/"&gt;Shopify&lt;/a&gt; has done a great job making available the installation process available, you can simply use this link.&lt;/p&gt;

&lt;h2&gt;
  
  
  React Native Skia
&lt;/h2&gt;

&lt;p&gt;The rendering engine of Google Chrome is powered by SKIA. It is advised that you keep in mind that SKIA powers anything you view on the Google Chrome browser. The fact that Flutter is based on SKIA also explains the previous advantage it had over React Native. React Native Skia allows for a number of previously impossible tasks to be completed by integrating the Skia library and all of its features with React Native.&lt;/p&gt;

&lt;h2&gt;
  
  
  Things You Can't Do With React Native
&lt;/h2&gt;

&lt;p&gt;Before we talk about how revolutionary Skia would be in React Native, it seems important to point out a list of Advanced 2D use cases that cannot be accomplished on React Native.&lt;/p&gt;

&lt;h2&gt;
  
  
  Graphics Performance
&lt;/h2&gt;

&lt;p&gt;2D graphic capabilities are a hole to feel and SKIA has a handful of solutions to offer. Graphics are one of the most tiring weaknesses in React native.&lt;/p&gt;

&lt;h2&gt;
  
  
  SVG and Inset Shadows on Android
&lt;/h2&gt;

&lt;p&gt;Making certain apps where you get to render huge SVG's would result in bottle-necked performance. As a fan of neomorphic designs, I frequently come into difficulties with drop shadows on Android. This is a basic feature that has, for a considerable amount of time, gone unattended. On a competent smartphone, graphics can operate at a rate of five frames per second. Not the best you wish for.&lt;/p&gt;

&lt;h2&gt;
  
  
  Text Animation
&lt;/h2&gt;

&lt;p&gt;This is a problem with React Native since there have been numerous projects and libraries created to address it, but their success and outcomes were hardly sustained because each one had its own solutions that didn't withstand the test of time.&lt;/p&gt;

&lt;h1&gt;
  
  
  What To Expect From The Skia Library
&lt;/h1&gt;

&lt;p&gt;React native SKIA would provide us with these;-&lt;/p&gt;

&lt;h2&gt;
  
  
  Lower Number Of Required Lines Of Code
&lt;/h2&gt;

&lt;p&gt;Here I will provide an example of how Skia would enable streamlined code. I think a good example of this will be charting. Take a look at how much code it requires to create in Skia (from examples in Shopify/React-native-Skia repo) and then take a look at the average animated linear chart library code. It is clearly streamlined.&lt;/p&gt;

&lt;h2&gt;
  
  
  High Performance
&lt;/h2&gt;

&lt;p&gt;Both on Android and IOS, SKIA offers significantly superior performance, but it is more obvious on Android. Many programmers believe JavaScript to be slow, however React Native SKIA makes it seem considerably faster. It is anticipated that this will require extensive optimization to work flawlessly. Not to overwhelm us, but switching back to ordinary React-Native (without Skia) would be much more challenging; after all, who doesn't prefer an easy path?&lt;/p&gt;

&lt;h2&gt;
  
  
  Inset Shadow
&lt;/h2&gt;

&lt;p&gt;With react native SKIA we can always inset shadows, it's amazing because it's not just a box-shadow implementation we get from this library, it's a general-purpose Integration we could use to create any high-performing graphics. In cases where you want to customize UI components with a bit of styling here and there and some primitive like shadows. Instead of doing all of this, you write a maximum of five lines of skia and you are out there.&lt;/p&gt;

&lt;h2&gt;
  
  
  Text Animation
&lt;/h2&gt;

&lt;p&gt;Text animation is made easier as we get animation by default. This would allow us to build incredibly smooth 2D animations for React Native and also be able to use a React like API Declarative syntax.&lt;/p&gt;

&lt;h2&gt;
  
  
  Why Is This So Hyped?
&lt;/h2&gt;

&lt;p&gt;I'll provide a very general explanation of why this is so hyped: with this integration, we'll be able to close the gap in the React Native framework.&lt;/p&gt;

&lt;p&gt;React Native excels at interacting with UI elements, including complicated animation, but it struggles when dealing with arbitrary motion, such as drawing and rotating an Octagon, because it cannot be readily descended from a native UI element. This is where Skia comes into action. I only hope you understand that it gives you access to an engine like Web Canvas to handle situations like these.&lt;/p&gt;

&lt;h1&gt;
  
  
  Conclusion
&lt;/h1&gt;

&lt;p&gt;I outlined a few issues that developers face in our previous sub-topic, as well as all of the potential remedies SKIA offers for us.&lt;br&gt;
We were able to highlight what React Native could not do, and the Skia library for React-Native is a wonderful addition. We also went through the installation procedure. Special thanks goes out to Chris, Williams, and all the React Native developers; this is a significant development.&lt;/p&gt;

</description>
    </item>
    <item>
      <title>AUTHENTICATION WITH FAUNA</title>
      <dc:creator>marvelken</dc:creator>
      <pubDate>Sat, 18 Sep 2021 10:48:01 +0000</pubDate>
      <link>https://dev.to/marvelken/authentication-with-fauna-2on</link>
      <guid>https://dev.to/marvelken/authentication-with-fauna-2on</guid>
      <description>&lt;p&gt;Author;- Marvel Ken.&lt;/p&gt;

&lt;h2&gt;
  
  
  Introduction
&lt;/h2&gt;

&lt;p&gt;Fauna is a general-purpose, distributed database supporting multiple data models and strong&lt;br&gt;
global consistency for modern app developers in the server-less era. Fauna uses many&lt;br&gt;
coding languages like &lt;code&gt;JavaScript, Nordjs, Java, C#, Scala, Python, GraphQL.&lt;/code&gt;&lt;br&gt;
Fauna provides authentication and authorization features that makes it easy to provide clients&lt;br&gt;
with direct access to your database in a secure and controlled way. This tutorial shows you&lt;br&gt;
how to use user authentication and control access to information with attribute-based access&lt;br&gt;
control (ABAC).&lt;/p&gt;

&lt;h2&gt;
  
  
  User authentication
&lt;/h2&gt;

&lt;p&gt;Fauna offers built-in identity, authentication, and password management. In user&lt;br&gt;
Authentication, we will look at creating user identity, authenticating them, and managing&lt;br&gt;
seasons. We will divide this part into sections: setting up, creating user, user login, user&lt;br&gt;
logout, changing user password, checking user credentials, and third-party delegation.&lt;/p&gt;

&lt;h2&gt;
  
  
  SETTING UP
&lt;/h2&gt;

&lt;p&gt;The setup section describes all the preparatory work needed for authenticating the user. They&lt;br&gt;
include: creating a database, creating a server key, creating a client key, creating a collection&lt;br&gt;
to store user documents, and creating a public index for users.&lt;br&gt;
First you need to sign up for a free Fauna account.&lt;/p&gt;

&lt;h2&gt;
  
  
  Creating a databases
&lt;/h2&gt;

&lt;p&gt;In user authentication, We need the context of a specific application. With this, we can create&lt;br&gt;
an application-specific database and call it “APPA.” the following query will create our&lt;br&gt;
database:&lt;br&gt;
&lt;code&gt;my_db&amp;amp;gt;CreateDatabase({&lt;br&gt;
name: &amp;amp;quot;APPA&amp;amp;quot;&lt;br&gt;
})&lt;/code&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Creating a server key
&lt;/h2&gt;

&lt;p&gt;In user authentication, We need the context of a specific application. With this, we can create&lt;br&gt;
an application-specific database and call it “APPA.”&lt;br&gt;
Our application is going to need access to our new database though We don’t need to permit&lt;br&gt;
all databases. We create a “server” key that will full access to a specific database.&lt;br&gt;
This query will create our server key:&lt;br&gt;
&lt;code&gt;my_db&amp;amp;gt;CreateKey({&lt;br&gt;
name: &amp;amp;quot;Server key for APPA&amp;amp;quot;,&lt;br&gt;
database: Database(&amp;amp;quot;APPA&amp;amp;quot;),&lt;br&gt;
role: &amp;amp;quot;server&amp;amp;quot;,&lt;br&gt;
})&lt;/code&gt;&lt;br&gt;
After you run the query, different values will be generated. The values need to be copied for&lt;/p&gt;

&lt;p&gt;the secret field. This is the key that authorizes Fauna, Specifically the associated database.&lt;br&gt;
Note that this key is only generated once if the lost new key needs to be developed.&lt;/p&gt;

&lt;h2&gt;
  
  
  Creating a client key
&lt;/h2&gt;

&lt;p&gt;We need to allow applications, public clients, typically a web browser, to access our “APPA”&lt;br&gt;
database and enable a key into the public client to permit the access. When creating a client&lt;br&gt;
key, the following query is written in the shell. After running the query we need to copy the&lt;br&gt;
security field results, since it is displayed once.&lt;br&gt;
&lt;code&gt;my_db&amp;amp;gt;CreateKey({&lt;br&gt;
name: &amp;amp;quot;Client key for app1&amp;amp;quot;,&lt;br&gt;
database: Database(&amp;amp;quot;APPA&amp;amp;quot;),&lt;br&gt;
role: &amp;amp;quot;client&amp;amp;quot;,&lt;br&gt;
})&lt;/code&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Creating a collection to store user documents.
&lt;/h2&gt;

&lt;p&gt;After creating an App-specified database and keys to access it, we need to create a collection&lt;br&gt;
to store user documents. We use our saved server key to log in to the database and then&lt;br&gt;
create a collection to store user documents using the following query:&lt;br&gt;
&lt;code&gt;my_db&amp;amp;gt; CreateCollection({ name: &amp;amp;quot;users&amp;amp;quot; })&lt;/code&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Creating a public public index for our user
&lt;/h2&gt;

&lt;p&gt;We need an index to make it possible to look at our user by their email address. We need this&lt;br&gt;
index to be public, since unauthorized users would be using the client key when attempting to&lt;br&gt;
log in, that's why we need the index. We create it using the following query:&lt;br&gt;
&lt;code&gt;my_db&amp;amp;gt; CreateIndex({&lt;br&gt;
name: &amp;amp;quot;users_by_email&amp;amp;quot;,&lt;br&gt;
permissions: { read: &amp;amp;quot;public&amp;amp;quot;},&lt;br&gt;
source: Collection(&amp;amp;quot;users&amp;amp;quot;),&lt;br&gt;
terms: [{field: [&amp;amp;quot;data&amp;amp;quot;, &amp;amp;quot;email&amp;amp;quot;]}],&lt;br&gt;
unique: true,&lt;br&gt;
}&lt;/code&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  USER LOGIN
&lt;/h2&gt;

&lt;p&gt;When a user wants to log in, they need to provide their email and password. Then we use the&lt;br&gt;
login function to authenticate their access, and if valid, give them a token that they can use to&lt;br&gt;
access resources.&lt;br&gt;
A token only provides access according to the privileges granted by an attribute-based&lt;br&gt;
access control(ABAC) role. This differs from keys, which are used to offer a coarser&lt;br&gt;
database_level_access. The following query calls Login on the result of looking up the user&lt;br&gt;
via the users_by_email index, with the password that they provided:&lt;br&gt;
&lt;code&gt;my_db&amp;amp;gt; Login(&lt;br&gt;
Match(Index(&amp;amp;quot;users_by_email&amp;amp;quot;), &amp;amp;quot;samson@site.example&amp;amp;quot;),&lt;br&gt;
{ password: &amp;amp;quot;secret password&amp;amp;quot; },&lt;br&gt;
)&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;After you run the query, the following development will be displayed:&lt;/p&gt;

&lt;p&gt;&lt;code&gt;{ ref: Ref(Tokens(), &amp;amp;quot;251407817091580416&amp;amp;quot;),&lt;br&gt;
ts: 1576020028130000,&lt;br&gt;
instance: Ref(Collection(&amp;amp;quot;users&amp;amp;quot;), &amp;amp;quot;251407645221585408&amp;amp;quot;),&lt;br&gt;
secret: &amp;amp;#39;fnEDfS4T34ACAAN9IwrU8aQA5SxTgyqYaUfiAqLqzQjQH9Qcr94&amp;amp;#39;}&lt;br&gt;
If the user cannot be found, or if their credentials are invalid, an error would be returned:&lt;br&gt;
my_db&amp;amp;gt; Login(&lt;br&gt;
Match(Index(&amp;amp;quot;users_by_email&amp;amp;quot;), &amp;amp;quot;samsam@not.a.member&amp;amp;quot;),&lt;br&gt;
{ password: &amp;amp;quot;secret password&amp;amp;quot; },&lt;br&gt;
)&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;results:&lt;br&gt;
&lt;code&gt;[{ position: [],&lt;br&gt;
code: &amp;amp;#39;authentication failed&amp;amp;#39;,&lt;br&gt;
description:&lt;br&gt;
&amp;amp;#39;The document was not found or provided password was incorrect.&amp;amp;#39; }]&lt;/code&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  USER LOG OUT
&lt;/h2&gt;

&lt;p&gt;After you call Logout, All the tokens associated with the current session are invalidated,&lt;br&gt;
effectively logging out the user. A new token would need to be created for any future access.&lt;br&gt;
Logout takes a single parameter all_tokens. When all_tokens are true, all tokens associated&lt;br&gt;
with the current user are invalidated, logging the user out completely. When all_tokens are&lt;br&gt;
false, only the current token is invalidated; any other active tokens are still valid.&lt;br&gt;
Only call Logout when connecting to Fauna with a token received from calling Login. In your&lt;br&gt;
client application code, that query would look similar to this JavaScript code:&lt;br&gt;
&lt;code&gt;my_db&amp;amp;gt; client.query(q.Logout(true))&lt;/code&gt;&lt;br&gt;
When you execute this query, a response of true indicates that log out was successful, and&lt;br&gt;
false indicates that log out failed.&lt;/p&gt;

&lt;h2&gt;
  
  
  CHANGING A USER PASSWORD
&lt;/h2&gt;

&lt;p&gt;Changing a user’s password is done by calling the Update or Replace functions with a new&lt;br&gt;
password in the credentials field. When a password is updated, any existing tokens remain&lt;br&gt;
valid.&lt;br&gt;
To change the user password, the following query can be used:&lt;/p&gt;

&lt;p&gt;&lt;code&gt;my_db&amp;amp;gt; Update(&lt;br&gt;
Ref(Collection(&amp;amp;quot;users&amp;amp;quot;), &amp;amp;quot;251407945291585008&amp;amp;quot;),&lt;br&gt;
{&lt;br&gt;
credentials: { password: &amp;amp;quot;new password&amp;amp;quot; },&lt;br&gt;
}&lt;br&gt;
)&lt;br&gt;
After changing password, we need to get a new token based on the new password, using&lt;br&gt;
the following query:&lt;br&gt;
my_db&amp;amp;gt; Login(&lt;br&gt;
Match(Index(&amp;amp;quot;users_by_email&amp;amp;quot;), &amp;amp;quot;samson@site.example&amp;amp;quot;),&lt;br&gt;
{ password: &amp;amp;quot;new password&amp;amp;quot; },&lt;br&gt;
)&lt;/code&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  CHECKING CREDENTIALS
&lt;/h2&gt;

&lt;p&gt;Users can be verified without creating a token, and this is done by calling the identity function.&lt;br&gt;
For example, we can test whether the old and new credentials for our user are valid using the&lt;br&gt;
following query:&lt;br&gt;
&lt;code&gt;my_db&amp;amp;gt;[&lt;br&gt;
identity(&lt;br&gt;
Ref(Collection(“users”),”251423556667638838666”),&lt;br&gt;
“secret password”,&lt;br&gt;
)&lt;br&gt;
identity(&lt;br&gt;
Ref(Collection(“users”),”251423567546676388386”),&lt;br&gt;
“new password”,&lt;br&gt;
)&lt;br&gt;
]&lt;/code&gt;&lt;br&gt;
After running this query the result should be either true or false.&lt;/p&gt;

&lt;h2&gt;
  
  
  THIRD PARTY DELEGATION
&lt;/h2&gt;

&lt;p&gt;Third-party delegation is the scenario where a third party uses our APIs to provide services to&lt;br&gt;
our users.&lt;br&gt;
Using the authentication features of Fauna, we can provide unique tokens for each third-party&lt;br&gt;
client that allow the third party to access resources on behalf of our users, while providing a&lt;br&gt;
way for the user to revoke the third-party client’s access.&lt;br&gt;
First, we create an index that allows us to list all of a user’s tokens. Login allows us to attach&lt;br&gt;
data to a token by adding extra fields. We’ll use this capability to identify our tokens with the&lt;br&gt;
name of the third-party service that will use the tokens.&lt;br&gt;
EXAMPLE:&lt;br&gt;
&lt;code&gt;my_db&amp;amp;gt; CreateIndex({&lt;br&gt;
name: &amp;amp;quot;tokens_by_instance&amp;amp;quot;,&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;code&gt;permissions: { read: &amp;amp;quot;public&amp;amp;quot; },&lt;br&gt;
source: Tokens(),&lt;br&gt;
terms: [{ field: &amp;amp;quot;instance&amp;amp;quot; }],&lt;br&gt;
values: [{field: [&amp;amp;quot;data&amp;amp;quot;, &amp;amp;quot;name&amp;amp;quot;]}]&lt;br&gt;
})&lt;/code&gt;&lt;br&gt;
Now we can create a token for each third-party service that our user uses. And we can do it&lt;br&gt;
all in a single query.&lt;br&gt;
The following query can be used:&lt;br&gt;
&lt;code&gt;my_db&amp;amp;gt; Map(&lt;br&gt;
[&lt;br&gt;
&amp;amp;quot;Desktop App&amp;amp;quot;,&lt;br&gt;
&amp;amp;quot;Mobile App&amp;amp;quot;,&lt;br&gt;
&amp;amp;quot;Web Service&amp;amp;quot;&lt;br&gt;
],&lt;br&gt;
Lambda(&lt;br&gt;
&amp;amp;quot;service&amp;amp;quot;,&lt;br&gt;
Login(&lt;br&gt;
Match(Index(&amp;amp;quot;users_by_email&amp;amp;quot;), &amp;amp;quot;samson@site.example&amp;amp;quot;),&lt;br&gt;
{&lt;br&gt;
password: &amp;amp;quot;new password&amp;amp;quot;,&lt;br&gt;
data: { name: Var(&amp;amp;quot;service&amp;amp;quot;) }&lt;br&gt;
}&lt;br&gt;
)&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;Finally, in client application code, list all the currently logged-in user’s tokens by querying the&lt;br&gt;
index that we built, when connecting to Fauna using the user’s token. The following code is&lt;br&gt;
written in JavaScript:&lt;br&gt;
&lt;code&gt;my_db&amp;amp;gt;client.query(&lt;br&gt;
q.Paginate(&lt;br&gt;
q.Match(&lt;br&gt;
q.Index(&amp;amp;quot;tokens_by_instance&amp;amp;quot;),&lt;br&gt;
q.Select(&amp;amp;quot;instance&amp;amp;quot;, q.Identity())&lt;br&gt;
)&lt;br&gt;
)&lt;br&gt;
)&lt;br&gt;
)&lt;br&gt;
.then((ret) =&amp;amp;gt; console.log(ret))&lt;br&gt;
.catch((err) =&amp;amp;gt; console.log(&amp;amp;quot;Error:&amp;amp;quot;, err))&lt;br&gt;
After executing this query in your client application code, after the user has logged in&lt;br&gt;
successfully, the output should be:&lt;br&gt;
{ data: [ &amp;amp;#39;Desktop App&amp;amp;#39;, &amp;amp;#39;Mobile App&amp;amp;#39;, &amp;amp;#39;Web Service&amp;amp;#39; ] }&lt;/code&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Access to Information with Attribute-Based Access Control(ABAC).
&lt;/h2&gt;

&lt;p&gt;Attribute-based access control (ABAC) is a flexible, fine-grained strategy for managing&lt;br&gt;
identity-based operations within Fauna. ABAC extends the default Fauna authentication and&lt;br&gt;
authorization mechanisms.&lt;/p&gt;

&lt;p&gt;ABAC has a role-based access control (RBAC), where roles can define privileges that can be&lt;br&gt;
dynamically determined based on any attribute of the actor attempting to access or modify&lt;br&gt;
data, any attribute of the data to be accessed or modified, or contextual information available&lt;br&gt;
during a transaction.&lt;br&gt;
A role defines a set of privileges-specific actions that can be executed on specific resources&lt;br&gt;
and membership-specific identities that should have the specified privileges.&lt;br&gt;
This can be done in the following sections; privilege section, membership section, Predicate&lt;br&gt;
functions, Overlapping roles.&lt;br&gt;
Privilege section&lt;br&gt;
Privilege specifies the resource in Fauna, where the resource could be a database, collection,&lt;br&gt;
document, key, index, function.&lt;br&gt;
I. The actions available vary according to the target resource: Core schemas&lt;br&gt;
(Databases, Collections, Indexes, Functions, Keys): create and delete&lt;br&gt;
II. Documents: create, read, write, delete, history_read, history_write&lt;br&gt;
III. User-defined functions: call&lt;br&gt;
examples:&lt;br&gt;
&lt;code&gt;mydb&amp;amp;gt; CreateRole({&lt;br&gt;
name: &amp;amp;quot;access_todos&amp;amp;quot;,&lt;br&gt;
membership: [{ resource: Collection(&amp;amp;quot;users&amp;amp;quot;) }],&lt;br&gt;
privileges: [{&lt;br&gt;
resource: Collection(&amp;amp;quot;todos&amp;amp;quot;),&lt;br&gt;
actions: {&lt;br&gt;
create: true,&lt;br&gt;
delete: true,&lt;br&gt;
write: true&lt;br&gt;
}&lt;br&gt;
}]&lt;br&gt;
})&lt;/code&gt;&lt;br&gt;
Membership section&lt;br&gt;
Membership describes the set of documents that should have the role’s privileges.&lt;br&gt;
Membership is managed with collection; documents in the collection are members of the role.&lt;br&gt;
Typically, a "document" would refer to a "user", but a document can be any record within&lt;br&gt;
Fauna.&lt;br&gt;
Membership can also be controlled with a predicate function for dynamic membership&lt;br&gt;
evaluation. Multiple roles can be associated with a Fauna resource, and users can be&lt;/p&gt;

&lt;p&gt;associated with multiple roles. Attribute-based access is computed for every Fauna&lt;br&gt;
transaction, and updates to the role configuration take effect immediately. Also, action&lt;br&gt;
permissions can be computed dynamically via Lambda functions.&lt;br&gt;
Example:&lt;br&gt;
&lt;code&gt;my_db&amp;amp;gt;CreateRole({&lt;br&gt;
name: &amp;amp;quot;can_manage_todos&amp;amp;quot;,&lt;br&gt;
membership: [&lt;br&gt;
{&lt;br&gt;
resource: Collection(&amp;amp;quot;users&amp;amp;quot;),&lt;br&gt;
predicate: Query(Lambda(ref =&amp;amp;gt;&lt;br&gt;
Select([&amp;amp;quot;data&amp;amp;quot;, &amp;amp;quot;vip&amp;amp;quot;], Get(ref))&lt;br&gt;
))&lt;br&gt;
}&lt;br&gt;
],&lt;br&gt;
privileges: [&lt;br&gt;
// ...&lt;br&gt;
]&lt;br&gt;
})&lt;/code&gt;&lt;br&gt;
Predicate functions&lt;br&gt;
A predicate function is the FQL Lambda function that operates in a read-only fashion,&lt;br&gt;
accepting command-specific arguments, and returning true or false to indicate whether the&lt;br&gt;
action is permitted or prohibited. The actions and their associated arguments are:&lt;/p&gt;

&lt;p&gt;-Create: the new data that is about to be created.&lt;br&gt;
-Read, history_read, delete: the ref to the underlying document.&lt;br&gt;
-Read for indexes: the terms being used to match against the index.&lt;br&gt;
-Write, history_write: the old data, the new data, and a reference to the document to&lt;br&gt;
be written.&lt;br&gt;
-Call: the parameters to be passed to the user-defined function.&lt;br&gt;
Example:&lt;/p&gt;

&lt;p&gt;&lt;code&gt;mydb&amp;amp;gt; CreateRole({&lt;br&gt;
name: &amp;amp;quot;can_manage_todos&amp;amp;quot;,&lt;br&gt;
membership: [&lt;br&gt;
// ...&lt;br&gt;
],&lt;br&gt;
privileges: [&lt;br&gt;
{&lt;br&gt;
resource: Collection(&amp;amp;quot;todos&amp;amp;quot;),&lt;br&gt;
actions: {&lt;br&gt;
create: Query(Lambda(newData =&amp;amp;gt;&lt;br&gt;
Select([&amp;amp;quot;data&amp;amp;quot;, &amp;amp;quot;vip&amp;amp;quot;], Get(Identity()))&lt;br&gt;
)),&lt;br&gt;
// ...&lt;br&gt;
}&lt;br&gt;
}&lt;br&gt;
]&lt;br&gt;
}&lt;/code&gt;&lt;br&gt;
Example role&lt;/p&gt;

&lt;p&gt;&lt;code&gt;mydb&amp;amp;gt; CreateRole({&lt;br&gt;
name: &amp;amp;quot;users&amp;amp;quot;,&lt;br&gt;
membership: [&lt;br&gt;
{&lt;br&gt;
// This role will be assigned to all users&lt;br&gt;
// as long as they are active&lt;br&gt;
resource: Collection(&amp;amp;quot;users&amp;amp;quot;),&lt;br&gt;
predicate: Query(ref =&amp;amp;gt;&lt;br&gt;
Select([&amp;amp;quot;data&amp;amp;quot;, &amp;amp;quot;isActive&amp;amp;quot;], Get(ref), false)&lt;br&gt;
)&lt;br&gt;
}&lt;br&gt;
],&lt;br&gt;
privileges: [&lt;br&gt;
{&lt;br&gt;
resource: Collection(&amp;amp;quot;todos&amp;amp;quot;),&lt;br&gt;
actions: {&lt;br&gt;
write:&lt;br&gt;
// The following function enforces that you can write to your&lt;br&gt;
// own data but, you can&amp;amp;#39;t change the owner of the data&lt;br&gt;
Query((oldData, newData) =&amp;amp;gt;&lt;br&gt;
And(&lt;br&gt;
Equals(&lt;br&gt;
Identity(),&lt;br&gt;
Select([&amp;amp;quot;data&amp;amp;quot;, &amp;amp;quot;owner&amp;amp;quot;], oldData)&lt;br&gt;
),&lt;br&gt;
Equals(&lt;br&gt;
Select([&amp;amp;quot;data&amp;amp;quot;, &amp;amp;quot;owner&amp;amp;quot;], oldData),&lt;br&gt;
Select([&amp;amp;quot;data&amp;amp;quot;, &amp;amp;quot;owner&amp;amp;quot;], newData),&lt;br&gt;
)&lt;br&gt;
)&lt;br&gt;
)&lt;br&gt;
}&lt;br&gt;
}&lt;br&gt;
]&lt;br&gt;
})&lt;/code&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Overlapping roles.
&lt;/h2&gt;

&lt;p&gt;When a document is a member of two or more roles, Fauna does its best to optimize for the&lt;br&gt;
most common access pattern, to avoid evaluating roles especially predicates unnecessarily.&lt;br&gt;
The general approach is that once permission to perform a specific action for a specific&lt;br&gt;
resource has been granted, no further determinations for that &lt;code&gt;resource+action&lt;/code&gt; need to be&lt;br&gt;
performed the first granted access wins.&lt;/p&gt;

&lt;p&gt;The table stores the resolution of permissions, keyed on the combination of resource identifier&lt;br&gt;
and requested action, involved in the current query.&lt;br&gt;
During role processing, if a &lt;code&gt;resource+action&lt;/code&gt; permission evaluates to true, or can be trivially&lt;br&gt;
determined to be true, the permission is granted and no further evaluations for that specific&lt;br&gt;
&lt;code&gt;resource+action&lt;/code&gt; are performed.&lt;/p&gt;

&lt;h2&gt;
  
  
  CONCLUSION
&lt;/h2&gt;

&lt;p&gt;We have come to the end of our project. We covered all you need to know about&lt;br&gt;
authentication with Fauna. The above tutorial exemplified how to use user authentication and&lt;br&gt;
control access to information with attribute-based access control (ABAC).&lt;br&gt;
&lt;code&gt;Written in connection with the Write with Fauna Program.&lt;/code&gt;&lt;/p&gt;

</description>
    </item>
  </channel>
</rss>
