Difficulty incorporating openId selector into Asp.Net MVC 2

I have been attempting to implement OpenID login functionality on a website using the openid selector JavaScript library. I am following the guidelines provided on this particular site. However, as someone who is not typically a web programmer, I am facing issues with getting it to work and I am unsure of the reason behind this. It seems like it could be something minor, but it's escaping my notice.

The main problem I am encountering is that no image containing the OpenID elements appears where it should, specifically within the

<div id="openid_btns"></div>
section. This leads me to believe that the function responsible for populating this div is not being executed.

My suspicion initially fell upon the scripts.

I followed the instructions to add script references to the Site.Master file as per below:

<script type="text/javascript" src="../../Scripts/jquery-1.4.1.min.js"></script>  
<script type="text/javascript" src="../../Scripts/openid-jquery.js"></script>  
<script type="text/javascript">
    $(document).ready(function () {
        alert("document ready"); // <- I added this to verfiy that this is being called
        openid.init('openid_identifier');
    });  
</script>  

It appears to be invoking the function on every page (the alert pops up), which should mean that the openid.init function is also being triggered afterwards.

This function is defined within the `openid-jquery.js` script:

// Script content here...

I inserted an `alert("initializing")` line into the script, but it never appeared to execute.

Should this function actually be running? How can I inspect why it isn't working as expected? Any thoughts?

UPDATE:

In the document ready function, I swapped the order of the functions like so:

<script type="text/javascript">
    $(document).ready(function () {            
        openid.init('openid_identifier');
        alert("document ready"); 
    });  
</script>  

Now, the alert doesn't appear. What does this indicate? Could there be an issue with the other function? How can I troubleshoot this further?

UPDATE 2:

Oddly, if I rename the `openid-jquery.js` file to something different (anything at all, such as `openid-jquery.2.js`), then I'm able to see the alert from the OpenID script.

However, it only seems to trigger the initial alert and not the subsequent lines. When I add another alert later on (after the very next line), the second alert remains unseen. I'm unsure about the reason behind this as well.

UPDATE 3:

After debugging in Chrome, it appears that the issue stemmed from `providers_large` and `providers_small` not being defined. Adding the following lines to the beginning of the script allowed it to execute and display the alerts. Nonetheless, the images are still not appearing... Looks like I need to investigate further.

Answer โ„–1

It appears that an update is needed in step 4 of the instructions to include the English JavaScript provider information, specifically where the provider_large is defined. Here is the updated code snippet:

<script type="text/javascript" src="../../Scripts/jquery-1.4.1.min.js"></script>  
<script type="text/javascript" src="../../Scripts/openid-jquery.js"></script> 
<script type="text/javascript" src="../../Scripts/openid-jquery-en.js"></script>  
<script type="text/javascript">
    $(document).ready(function () {
        alert("document ready"); // <- Added for verification
        openid.init('openid_identifier');
    });  
</script>  

Answer โ„–2

A small adjustment to the response provided by Sam for version 1.3.

Unzipped Files:

C:\Blah\openid-selector-1.3\openid-selector\js\openid-en.js

Script Tag:

<script type="text/javascript" src="../../Scripts/openid-en.js"></script>

Answer โ„–3

Encountered a similar issue, solution involved updating the web.config file to grant permission for all users to access the specified directories. After making this adjustment, everything functioned as expected.

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

Refresh the Data Displayed Based on the Information Received from the API

As someone who is relatively new to React, I have been making progress with my small app that utilizes React on the frontend and a .NET Core API on the server-side to provide data. However, I have encountered a problem that I've been grappling with fo ...

What is the best way to parse a JSON file and create a dynamic webpage using jQuery with the data from the

As someone who is new to working with Node.js and JSON, I am encountering some issues when trying to extract data from a JSON file. Below is the code that I have written: 'use strict'; const fs = require('fs'); let questsRawData = fs ...

Tips for creating a personalized dialog box after logging in with React Admin based on the server's response

One of my requirements is to allow users to select a role during the login process. Once the user enters their username and password, the server will respond with the list of available roles. How can I implement a dialog where the user can choose a role fr ...

UTF-8 characters not displaying correctly in Python 3 when received through WebSocket?

I am encountering an issue with sending a JavaScript unicode star character. When interpreted by Python, the unicode characters are being displayed as the letter รข, both in the console and log file. Furthermore, other unicode characters also seem to be ...

I keep encountering an error that says "ReferenceError: localStorage is not defined" even though I have already included the "use

I have a unique app/components/organisms/Cookies.tsx modal window component that I integrate into my app/page.tsx. Despite including the 'use client' directive at the beginning of the component, I consistently encounter this error: ReferenceErr ...

What types of numerical values is the Number data type capable of storing?

Is it true that a JavaScript number has the ability to store both a 64-bit number and a 64-bit Integer? I'm still unsure about this concept. ...

Incorporate a fresh label for a function utilizing AngularJS

I want to insert a new HTML tag with an event attached to it. Here is an example of what I am trying to achieve: <html ng-app="module"> <head> <script src="http://code.jquery.com/jquery-latest.min.js" type="text/javascript"></script&g ...

Setting the $dirty flag to true when a value is entered in the text box, but not the other way around

When I enter a value in the text box, myForm.$dirty gets set to true. However, the flag does not revert back to false when I delete all values from the text box. Why is this happening and how can I fix it? <input name="input" ng-model="myModel.text"& ...

Mobile Size Setting

Could someone please explain to me why when I test this code on Google Chrome using the mobile emulator for Galaxy S3, it displays the correct size (640x360), but when I try to load it on my actual Galaxy S5 or any other device, the size is different from ...

What's the proper way to mention HTML React component classes without triggering their execution?

When working with HTML React components like div, a, p, li, we typically write them in JSX syntax: <div>Hello</div> However, how can we reference one of these components without actually "using" them? For custom components, we can import, ref ...

Cloud Firestore query error in Firebase Cloud Function despite data being present in Cloud Firestore

I'm facing an issue with my cloud function. The function is designed to query data from a Cloud Firestore collection, which exists. However, when I call the function from my iOS app, it always goes to the else statement and prints "NOT IN COLLECTION." ...

Can CSS be used to create drop down menus?

Is it possible to create a dropdown menu using only CSS, similar to what you would find in most applications? I have a simple menu bar at the top of my screen and I want to be able to hover over an item like "Item1" and see sub-items appear below it. I en ...

What is the best way to retrieve the ID of the list item that has been clicked during a button event?

How can I use jQuery to get the ID of a selected list item when clicking a button in my HTML code? <ul id="nav"> <li><a href="#" rel="css/default.css" id="default" > <div class="r1"></div> </a>< ...

Guide to resolving a blank webpage issue post running 'npm run build'

I am currently in the process of working on a project that involves Vue and Firebase. Unfortunately, I have encountered an issue where my development server is no longer rendering new routes from my Vue router after building and deploying to production. F ...

File input onChange event not triggering after pressing SPACE or ENTER key

My React component features an img tag that allows users to select an image from their computer to display in it. While this component functions correctly on most browsers, I encountered an issue specifically with Chromium based browsers (tested on Chrome, ...

StopDefault and JSON Placement

We have a form that sends data to an external domain using JSONP to avoid cross-domain limitations. Everything is functioning properly except for preventing the default form submission that triggers a page reload. Below is the HTML code for the form: < ...

Increase the controller value through an Ajax call made in the URL

I've encountered a peculiar issue. When I run my Visual Studio and click on a specific button in the browser, an ajax function is triggered but displays an error. After some debugging, I discovered that the URL is causing the problem: POST http://l ...

Guide on how to call a function in ascx code-behind using JavaScript within the framework of DotNetN

Currently, I am facing an issue with my module that involves submitting data to a SQL table in a database using code behind. My validation is done through javascript, and when a button is clicked and the data is valid, a div is displayed. However, the pr ...

Avoiding metacharacters and utilizing them as a string variable for selection

For example, I have a variable called myid, and its value is "abc xyz". Then, I use a function to escape metacharacters and assign the result to another variable like this: var x = "#"+escapechars(myid);. The evaluated value of x is #abc\\xyz. ...

Obtain the value of a dynamically selected option

I am facing an issue with my select options where I want the input field to be automatically filled with the 'data-place' value of the selected option whenever it changes. This includes a few dynamic select options. $(function() { // Hand ...