Semenalidery.com

IT Новости из мира ПК
2 просмотров
Рейтинг статьи
1 звезда2 звезды3 звезды4 звезды5 звезд
Загрузка...

In order to access this application

Rodger’s Notes

Technical notes from someone who knows a lot of things, about a lot of things.

Firefox, Oracle Apps, Java plugins, on 64 Bit Redhat 5.5

When using Firefox on Linux, have you ever got the aggravating message concerning oaj2se.exe, or NPX_PLUGIN_PATH? Here is the solution.

From what I have read, on Linux, using the Firefox browser for Oracle Forms is not certified. At least it wasn’t in the past. Bizarre.

On Redhat Linux, you try working with an app such as Oracle Apps, and navigate to where the software takes you. But you suddenly get the error message:

In order to access this application, you must install the J2SE Plugin version 1.6.0_07 on your client and NPX_PLUGIN_PATH environment variable is set before starting Netscape. To install this plugin, click here to download the oaj2se.exe executable. Once the download is complete, double-click the oaj2se.exe file to install the plugin. You will be prompted to restart your browser when the installation is complete.

The problem is, oaj2se.exe is an executable that only works on Windows.

You can try clicking the buttons. But it didn’t help me.

The following plugins are available.
Java runtime Environment: 1.6 u29
Next.
Java runtime Environment: 1.6 u29 Not available.

I clicked more, and got a webpage.
http://java.com/en/download/index.jsp
Free Java Download
Download Java for your desktop computer now!
Version 6 Update 30

Rants and Criticisms :

The problem is, there is already a LOT of java installed on my server. And I don’t want to overwrite any versions.

If you upgrade or overwrite versions in Linux, your applications may suddenly stop working! Do you ever see all the prerequisites and certification matrices for Oracle products? Don’t mess them up. Don’t get creative.

Only with the Linux operating system: you upgrade a Linux package or the operating system, and suddenly your existing applications on the server, that worked fine, may suddenly stop working. Bizarre! It’s happened enough times before for me to be careful. (See my post on installing Virtual Box, and the issues with kernel-devel.)

You have to hand it to Mr. Bill. When you patch or upgrade the Windows operating system, all the existing applications continue to work. If only everyone involved with Linux were as aware of this concept. And rigorously ensured that the same happened on Linux.

The other issue for me is, why is this a manual install? With the same Firefox, I clicked a few buttons, and installed the Flash player, and watched videos in just a few minutes. Why is something as important as java, also not put into a simple installation script, that works with a few mouse clicks? Let’s get with the program please.

How To Get Firefox To Work On Redhat :

Check Firefox version. Help, About Firefox. You will see if it is 32 or 64 bit. In my case: Mozilla/5.0 (X11; U; Linux x86_64;

Check if Firefox has the plugin, java. If you have this symptom, it probably doesn’t.

1)
Put this in the URL section:
about:plugins

2)
Tools, Addons, Plugins,

At least this is the navigation in Firefox version 3.0.18. My other beef is that software companies constantly change the navigation between releases.

In either case, if you don’t see: Java(TM) Plug-in, this is the problem.

Check your server to see if you have the Java jdk, and jre .

rpm -qa –qf “%-%-%_%.rpm n ” | grep “jdk” | sort
jdk-1.6.0_26-fcs_x86_64.rpm
ldapjdk-4.18-2jpp.3.el5_x86_64.rpm

rpm -qa –qf “%-%-%_%.rpm n ” | grep “jre” | sort
jre-1.6.0_22-fcs_i586.rpm

Note whether they are 32 or 64 bit versions.

If you don’t have these packages installed, you will need to download and install them. See the links at the bottom.

Find the location of the file: libnpjp2.so

libnpjp2.so is the culprit we need.

find / -type f -iname “libnpjp2.so” 2> /dev/null

I actually had this file in many places. But these ones are the relevant files. The others were specific to other applications. Stick with the generic ones.

Check if libnpjp2.so files are 32 or 64 bit :

file /usr/java/jre1.6.0_22/lib/i386/libnpjp2.so
/usr/java/jre1.6.0_22/lib/i386/libnpjp2.so: ELF 32-bit LSB shared object, Intel 80386, version 1 (SYSV), not stripped

file /usr/java/jdk1.6.0_26/jre/lib/amd64/libnpjp2.so
/usr/java/jdk1.6.0_26/jre/lib/amd64/libnpjp2.so: ELF 64-bit LSB shared object, AMD x86-64, version 1 (SYSV), not stripped

Note that one file is 32 bit, and the other 64 bit.

Since my Firefox is 64 bit, guess which file I will use?

Find the plugin directories for Firefox and Mozilla :

find / -type d -iname “plugin*” | grep -i -e “mozilla” -e “firefox”

Since we are concerned with 64 bit, ignore the 32 bit directories:

Find the plugin directory :

If you have already installed the flash player, and it works, a way to find the correct directory is to find the flash player link.

cd /usr/lib64/mozilla/plugins
ls -l
lrwxrwxrwx 1 root root 41 Nov 17 18:46 libflashplayer.so -> /usr/lib64/flash-plugin/libflashplayer.so

Create links in the plugin directories .

From above, change to the directory with the flash plugin, and create the link.

cd /usr/lib64/mozilla/plugins
ln -s /usr/java/jdk1.6.0_26/jre/lib/amd64/libnpjp2.so .

Bounce firefox to test.

If this doesn’t work, try creating links in the other directories. Turns out that I initially missed the first directory. But things worked after I created the link in the all other directories. Brute force algorithm.

cd /usr/lib64/mozilla/plugins-wrapped
ln -s /usr/java/jdk1.6.0_26/jre/lib/amd64/libnpjp2.so .

cd /etc/skel/.mozilla/plugins
ln -s /usr/java/jdk1.6.0_26/jre/lib/amd64/libnpjp2.so .

cd /home/applmgr/.mozilla/plugins
ln -s /usr/java/jdk1.6.0_26/jre/lib/amd64/libnpjp2.so .

cd /home/oracle/.mozilla/plugins
ln -s /usr/java/jdk1.6.0_26/jre/lib/amd64/libnpjp2.so .

Bounce firefox to test.

—————–
Check the plugins :

Tools, Addons, Plugins,

At this point, it worked.

Java(TM) Plug-in 1.6.0_26

File name: libnpjp2.so
The next generation Java plug-in for Mozilla browsers.

MIME Type Description Suffixes Enabled
application/x-java-vm Java Plug-in Yes
application/x-java-applet Java Plug-in Applet Yes

Interestingly, in about:plugins, the versions range from:

Applets:
application/x-java-applet;version=1.1

application/x-java-applet;version=1.6

Beans:
application/x-java-bean;version=1.1

application/x-java-bean;jpi-version=1.6.0_26

In my case, Oracle Apps and Forms. Of course, first, bring up the database, and all the Oracle Apps processes. Start Firefox. Open this URL:

OracleAS Forms Services
Welcome to the OracleAS Forms Services Run/Test page
This HTML form may be used to run any Forms application on the web

Run the form test.fmx with the correct port. Mine worked, but I got an FRM-92101 error. Not perfect. But at least further than before. Yet another issue!

Useful and Relevant Links :

How is that for instantly digestible? Hope this is useful! If it is, please leave a comment.

Primary Menu

Just another blog for Oracle Administrators

Home » General » How to open Oracle Apps R12 forms in Internet Explorer 11 (IE. 11)

1) In internet explorer 11 , navigate to Tools –> Compatibility View Settings . Then add Domain name in the URL (ex: orapps.com in erp.oraapps.com) using Add this website option.

2) Navigate to Tools –> Internet options –> Security . Select internet and click on Custom level. Scroll down till end of the options and change the option Enable XSS filter to Disable.

Adding Step 3 (08-Mar-2016)

3) Add EBS URL as Intranet Site in Internet Options to avoid most of the Java security related issues.

This solution worked for me and I am able to open R12 forms in Internet Explorer version 11.

Share this:

Like this:

Related

Post navigation

141 thoughts on “ How to open Oracle Apps R12 forms in Internet Explorer 11 (IE. 11) ”

Thank you so much for sharing. I got it working. Much Appreciated

this is awesome…I struggled days to open forms in IE11.Finally this solution worked for me too…thanks for the article

Worked for me too. Haven’t been using IE for a very long time….thanks!

Читать еще:  Random access iterator

Hi Sriram,
Thank you very much for your help. Now, I am able to open Forms in IE 11. Your help was great.
Please keep helping and posting.

works like a charm now!
Thanks

Thanks very much its really helpful

Hi i tried alot but its not working for me. Pls give me solutions on anjani.saxena@gmail.com

hi please can u send that solution doc to my email id manojkumar.oracleapps@gmail.com

Thanks. it worked for me …….

Thsnks worked for me

Thanks! Works perfectly!

awesome. This worked for me. Its very useful information for users who are using IE11

Hi Sriram,
I am trying to open the solution beacon visio instance for 12i http://vis1213.solutionbeacon.net. It still is not opening. It asks for permission to open the sites and I click “OK”. What may be the problem? I am using IE11 and did the changes you suggested.
Thanks,
Nagaraj

Have sent you email with suggestions. I hope that resolves the issue.

It works fine now Sriram. Thank you so much!

That’s great.. I am glad that the solution worked for you.

Thanks, Sriram. I have uninstalled Java 7 and 6 and now when prompted from solution beacon vision instance for R12, I have installed Java 6 again. I will try it and let you know.

Thanks for the info. I followed your tips and it worked for me.

I have Windows 8.1 and latest version of java Version7Update60. When opening forms I got message as below

“An application would like to access to an out-of-date version of JAva”
Options are
– Run with latest version on your system(recommended)
– Allow this application to run with requested version (1.6.0_07)

I chose the second option and forms opened. Did not try running with latest version.

Followed all the steps above. When trying to open get the below error message
In order to access this application, you must install the J2SE Plugin version 1.6.0_07. To install this plugin, click here to download the oaj2se.exe executable. Once the download is complete, double-click the oaj2se.exe file to install the plugin. You will be prompted to restart your browser when the installation is complete.
Inspite of installing again the same message.

Try uninstalling all java installations from your system and try these steps..

Hi Sriram , in my company Security tab is disabled. Could you suggest alternatives. It’s not working just with the Compatibility Settings View change

XSS filter can be disabled in registry if you have access to regedit.

Start –> RUN (enter regedit) navigate to the location specified below and change the DWORD value.

1409 DWORD 0x00000003

If you need to enable it, set the value back to 0x00000000

Excellent job! Thanks for the article!

Great. It worked for me as well for Oracle 11i . Thanks a lot for your solution :-).

Iam not able to open forms in IE 10 can you suggest me any modifications to my IE settings.
present I am trying to access 12.1.1 EBS

Hi Shiva,
Are you still having trouble in opening forms?

Thanks Sriram,
It’s working now….

Hi Sriram, im getting same error as srkanth, can you email me the steps ?

Thanks,
It is working for me…

Hi Admin, I am facing the same issue on Windows 7 32 and IE11. it’s still showing ‘Java applet loading’.
any ans. pl. revert. thank you.
Regards,
Sidharth M.

Sidharth,
Sorry for the delay in my response. Try adding the site to intranet site in internet options.

Hi,I followed the steps mentioned by you but still the page is throwing error like “security exception”, access denied. Can you pls help me. U can mail me.
Thanks in advance.
siva

Hi Sriram,I am getting the same error in IE11. Could you please mail me the steps to fix this issue.
My email id is senthilkumar.jothilingam@gmail.com

I have tried to disable the XSS filter through regedit since Securiy tab is disable. But still unable to open the forms in 11i.
Desktop : Windows 32 bit
JRE : 1.7.0_60
Browser : IE 11

I tried to open Oracle R12 Forms in my new laptop. It is not working I have done the above specified 2 steps . Still I am facing the same problem. Please help me on this

Hi Sriram
I am really happy for your support. After changing ie configuration, Now I am able to open R12 Forms. Thanks for your quick support

I am glad that I could help you. It’s a pleasure talking to you. Keep in touch

Thank you very much.i wish you to you will post these kind of information to all.

i did the steps but when i click on any form it doesn’t do any thing ,
no error , no message and didn’t open !!
what can i do?

Hey, I am sorry for the delayed reply. I hope the issue is already resolved. Posting here few steps, that could help other readers as well.

Try to uninstall all the existing java installations form your computer/laptop and then try to access forms.

Another quick fix for Java Security exception errors. Please see the steps below.

Navigate to Control Panel –> Java –> Security –> Click on Edit Site List and add your EBS URL: http://..com:

Worked for me after the compatibility settings. Tack!!

Awesome ! Works like a charm, thank you so much

thank a lot it helped me a lot

Hi Sriram, I have a new laptop. Windows 7 64 bit with IE 11 64 bit. Not able to open forms from vis1213apps.biztechmsp.com (12.1.3). Each time it is asking to install Java 6 update 7 even after install. Email mehsanus@yahoo.com. Hope to get some help from you

I have sent you email with steps. Try and let me know if you run into any issues.

Excellent!! Works like a charm!

Hi admin,I had followed the above two steps,but it is not working for me.Can you send the details steps in my email id khumukcham.prabit@gmail.com

Do you see any error message?

You are Awesome. Superb.It works.

I followed your steps and it did not launch the forms. instead I got this message

Ignored exception: java.security.PrivilegedActionException: java.io.IOException: Access is denied
Ignored exception: java.lang.NullPointerException
Ignored exception: java.lang.NullPointerException
Java Plug-in 1.6.0_07
Using JRE version 1.6.0_07 Java HotSpot(TM) Client VM
User home directory = C:UsersVincent

—————————————————-
c: clear console window
f: finalize objects on finalization queue
g: garbage collect
h: display this help message
l: dump classloader list
m: print memory usage
o: trigger logging
p: reload proxy configuration
q: hide console
r: reload policy configuration
s: dump system and deployment properties
t: dump thread list
v: dump thread stack
x: clear classloader cache
0-5: set trace level to
—————————————————-

load: class oracle/apps/fnd/formsClient/FormsLauncher.class not found.
java.lang.ClassNotFoundException: oracle.apps.fnd.formsClient.FormsLauncher.class
at sun.applet.AppletClassLoader.findClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at sun.applet.AppletClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at sun.applet.AppletClassLoader.loadCode(Unknown Source)
at sun.applet.AppletPanel.createApplet(Unknown Source)
at sun.plugin.AppletViewer.createApplet(Unknown Source)
at sun.applet.AppletPanel.runLoader(Unknown Source)
at sun.applet.AppletPanel.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
java.lang.ClassNotFoundException: oracle.apps.fnd.formsClient.FormsLauncher.class
at sun.applet.AppletClassLoader.findClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at sun.applet.AppletClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at sun.applet.AppletClassLoader.loadCode(Unknown Source)
at sun.applet.AppletPanel.createApplet(Unknown Source)
at sun.plugin.AppletViewer.createApplet(Unknown Source)
at sun.applet.AppletPanel.runLoader(Unknown Source)
at sun.applet.AppletPanel.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)

Looks like your login doesn’t have administrator privileges. Please check the permissions on your account.

Allow less secure apps to access your Gmail account

Google may block sign-in attempts from some apps or devices that do not use modern security standards. Since these apps and devices are easier to break into, blocking them helps keep your account safe.

Allowing Less Secure Apps

If you have to allow an application to access your Google account, you can disable this security block.

  1. Sign in to Gmail
  2. Click here to access Less Secure App Access in My Account.
  3. Next to “Allow less secure apps: OFF,” select the toggle switch to turn ON.
  4. Visit the Display Unlock Captcha pageand click Continue to remove the security block.
Читать еще:  Кодеки для powerpoint 2020

The Allow less secure apps setting may not be available for:

  • Accounts with 2-Step Verification (2FA) enabled. If 2FA is already enabled on your account, you should create an application-specific password and use this password for your application. If you still can’t access your account with an app password, visit the Display Unlock Captcha pageand click Continue to remove the security block.
  • G Suite users: This setting may not be available if your G Suite administrator has locked less secure app account access. Please read the G Suite section below or contact your G Suite administrator for help.

I still can’t log in..

If you still can’t log into your account through your application after changing the “Allow less secure apps” setting, consider enabling 2-Step Verification and creating an application-specific password.

If you cannot access your account using an app password, your application may not meet Google’s new security standards. For example, older versions of Outlook may no longer work with Google’s authentication system. Consider upgrading your application to the latest version and try logging in again.

G Suite Admins

G Suite Admins: Enabling less secure apps to access G Suite accounts

  1. Sign in to your Google Admin console (Sign in using an administrator account)
  2. Click Security > Less secure apps.
  3. Select Allow users to manage their access to less secure apps.
  4. Click Save.

  • Once you’ve set Allow usersto manage their access to less secure apps to on, affected G Suite users within the selected group or Organizational Unit will be able to toggle access for less secure apps on or off themselves. It may take a minute or so for the setting to take affect.
  • Now log in as the G Suite user and visit https://myaccount.google.com/lesssecureapps to toggle Less Secure Apps access.
  • G Suite Admins: Important Security Changes Coming

    Starting in June 2020, Google will limit the ability for less secure apps (LSAs) to access G Suite account data. This is most likely to impact users of legacy email, calendar, and contacts apps.

    LSAs are non-Google apps that can access your Google account with only a username and password. They make your account more vulnerable to hijacking attempts. Instead of LSAs, you can use apps that support OAuth—a modern and secure access method.

    Access to LSAs will be turned off in two stages:

    • After June 15, 2020 – Users who try to connect to an LSA for the first time will no longer be able to do so. This includes third-party apps that allow password-only access to Google calendars, contacts, and email via protocols such as CalDAV, CardDAV, IMAP, and Exchange ActiveSync (Google Sync). Users who have connected to LSAs prior to this date will be able to continue using them until usage of all LSAs is turned off.
    • After February 15, 2021 – Access to LSAs will be turned off for all G Suite accounts.

    For more information, please read Google’s blog article: Turning off less secure app access to G Suite accounts

    Let me know in the comments if this helped. Follow me on Twitter, Facebook and YouTube.

    Control access to less secure apps

    This article is for administrators. For actions users can take, go to Less secure apps & your Google Account.

    You can block sign-in attempts from some apps or devices that are less secure. Apps that are less secure don’t use modern security standards, such as OAuth. Using apps and devices that don’t use modern security standards increases the risk of accounts being compromised. Blocking these apps and devices helps keep your users and data safe.

    Examples of apps that don’t support modern security standards include:

    • ​Native mail, contacts, and calendar sync applications on older versions of iOS and OSX​
    • ​Some computer mail clients, such as older versions of Microsoft Outlook

    Examples of apps that do support modern security standards are Gmail, Windows Mail, Office 365, Outlook for Mac, Instagram, PayPal, Amazon, Facebook, and Basecamp.

    Transitioning to more secure app access to Google Accounts

    Less secure apps can make it easier for hijackers to break into user accounts and devices. Blocking sign-ins from these apps helps keep accounts safe. For these reasons, Google is limiting password-based programmatic sign-ins to Google Accounts.

    If you don’t allow sign-ins from less secure apps

    If you allow sign-ins from less secure apps

    Because Google is beginning to shut off Google Account access to less secure apps, the enforcement option is no longer available. We recommend turning off less secure apps access now. You should start using alternatives to less secure apps.

    As Google gradually moves away from allowing less secure apps to access Google Accounts, you’ll receive email notifications about changes that affect you.

    Notice of setting removal

    Google will automatically turn off the Less secure apps setting on individual accounts for users who stop using it. Users can turn it back on until the setting is removed.

    The Less secure apps setting will be removed from the Admin console in Feb, 2021. If you haven’t already transitioned to more secure apps, do so by this date.

    To promote better security for user accounts, you should start using alternatives to less secure apps as soon as possible.

    • Use apps in your company that use OAuth 2.0 authentication. Deploy new applications or update your existing apps to support OAuth 2.0 for authentication.
    • If some users can’t migrate to a more secure platform, they can use alternatives.

    Re-add your Google Account to Apple Mail and configure it to use IMAP with OAuth.

    This automatically initiates the connection with OAuth.

    Continue using iOS Mail as long as you have iOS 6.0 or later.

    OAuth support is automatically included in iOS 6.0 and later when you add an account using the Google option.

    Outlook for Windows via
    password-based POP or IMAP

    G Suite Sync for Microsoft Outlook (GSSMO).
    Web-based or latest version of Outlook.

    Re-add your Google Account to Thunderbird and configure it to use IMAP with OAuth.

    This automatically initiates the connection with OAuth.

    Legacy office devices

    Examples: scanners and multifunctional printers that send email

    How to add authentication to your universal Nuxt app using the nuxt/auth module

    Recently I was working on a Nuxt.js app and had to add authentication to it. First thing I thought was to use vuex to store two fields in a state:

    • isLoggedIn: a boolean representing whether user is logged in or not
    • loggedInUser: an object containing the user details for the session that we get from server

    And then I added a middleware on pages where I wanted to restrict access to logged in users only. The thought process for this approach is right but problem is that when you refresh the page, the state from vuex is lost. In order to handle that, you would need to use localStorage but that would work only if your app is running in spa mode, that is, on client side only. If you are running your app in universal mode (server side rendered) then you will also need to use cookies and write a custom middleware that checks whether it is running on client side or server side and then use localStorage or cookies accordingly. Doing all of this would be a good exercise to learn how everything works but adding it to a project where multiple people are working might not be a great idea in my opinion. Nuxt has an officially supported module just for this purpose. It’s the auth module. In this post, I will talk about how to integrate the auth module to your nuxt app to support authentication using email and password.

    Читать еще:  Типы данных в субд access

    Assumptions for the server API

    We are making the assumption that the API server:

    • Is running on http://localhost:8080/v1
    • Uses cookie based sessions
    • Has a JSON based API
    • Has the following API endpoints:
    • POST /v1/auth/login: accepts email and password in request body and authenticates the user
    • POST /v1/auth/logout: does not need request body and deletes the user session from server
    • GET /v1/auth/profile: returns the logged in user’s object

    Overview of the steps involved

    We will divide this post into following steps:

    • Installation of axios and auth modules
    • Configuration needed in nuxt.config.js
    • Using the state from auth module to check if user is logged in or not and accessing logged in user in our app components
    • Using the auth module to authenticate the user using email and password based authentication
    • Using middleware provided by the auth module to restrict access to pages to logged in users only

    Step 1: Install the axios and auth modules

    Open the terminal, navigate to the root directory of your project and run the following command:

    Step 2: Configure axios and auth modules

    Open your nuxt.config.js file, find the modules section and include the axios and auth modules and add their configuration:

    The auth object here includes the configuration. The auth module supports local strategy as well as OAuth2. Since we only have email and password based authentication in our case, we only need to provide the configuration for local strategy.

    The endpoints section is where we specify the details about our API server’s endpoints for login, logout and logged in user’s profile and each of the config looks like this:

    url and method should be consistent with your server API. The url here needs to be relative to the baseUrl config. The propertyName tells the auth module which property in the response object to look for. For example, if your API server reponse for GET /auth/profile is like this:

    Then you can set the propertyName as user to look for only the user key in the API response. If you want to use the entire API response, you need to set propertyName to false .

    Since our API server has cookie based sessions, we are setting the tokenRequired and tokenType to false .

    For a complete list of options supported by the auth module, you can visit their official documentation here

    The axios object in the above config is used to provide the axios configuration. Here, we are setting the following properties:

    baseUrl here is the root url of our API and any relative url that we hit using axios in our app will be relative to this url. Setting credentials as true ensures that we send the authentication headers to the API server in all requests.

    Step 3: Activate vuex store in your app

    In order to use the auth module, we need to activate vuex store in our application since that’s where the session related information will be stored. This can be done by adding any .js file inside the store directory of your app and nuxt will register a namespaced vuex module with the name of the file. Let’s go ahead and add a blank file called index.js to the store directory of our app. It’s not mandatory to add index.js file. You could have added any file for example xyz.js in the store directory and that would have activated vuex store in your app.

    The auth module that we have included in our project will automatically register a namespaced module named auth with the vuex store. And it has the following fields in the state:

    • loggedIn: A boolean denoting if the user is logged in or not
    • user: the user object as received from auth.strategies.local.user endpoint configured in our nuxt.config.js file.
    • strategy: This will be local in our case

    It also adds the necessary mutations for setting the state. So, even though we haven’t created any auth.js file in the store directory of our app, the auth module has automatically taken care of all this. If it helps to understand, imagine that a file named auth.js is automatically created by auth module in the store directory of your app even though this file doesn’t actually exists. This means that using mapState on auth module of your vuex store will work. For example, you can use this in any of your components or pages:

    Here is a complete example of a component using these properties:

    Alternative approach

    Instead of using the mapState, you can also reference the loggedIn and user by this.$auth.loggedIn and this.$auth.user. So, in the above example, you could have re-written the computed properties as mentioned below and it would have still worked fine:

    Step 4: Authenticating user using the auth module

    We know how to use the auth module’s APIs to check whether a user is logged in or not, or access the logged in user’s details. But we haven’t yet covered the part of how to authenticate the user. This is done by using the this.$auth.loginWith method provided by the auth module in any of your components or pages. The first argument to this function is the name of the strategy. In our case this will be local . It’s an async function which returns a promise. Here is an example of how to use it:

    So, typically you would have a login page with a form with email and password fields mapped to data of the component using v-model. And once you submit the form, you can run this function to authenticate using the auth module. Here is an example of login page:

    In order to logout a logged in user, you can use the this.$auth.logout method provided by the auth module. This one doesn’t need any arguments. Here is an example:

    Step 5: Using auth middleware to restrict access to certain pages

    The auth module also provides middleware to restrict access to logged in users. So, for example if you want to restrict the /profile route of your application to logged in users only, you can add the auth middleware to the profile.vue page like this:

    For more details on how you can configure your components and pages to use the auth middleware, you can check out the official docs here.

    Conclusion and References

    This was kind of a getting started post for axios and auth modules with NuxtJS. We only covered the local strategy but the auth module also supports OAuth2 and can be used to support login using Auth0, Facebook, Github and Google. I would definitely recommend checking out the Guide and API section of the auth module:

    The axios module also provides us many configuration options. Although we didn’t cover much of it in this post, but I would definitely recommend checking out the official docs for that as well:

    I hope this post was helpful in understanding the basics of auth module in Nuxt and makes it easier for you to navigate the rest of the official documentation on your own.

    Ссылка на основную публикацию
    Adblock
    detector