Giter Club home page Giter Club logo

Comments (5)

Ices-Eyes avatar Ices-Eyes commented on August 30, 2024 1

Hi,
yes, it makes sense, I used a similar approach in order to circumvent the problem, that is as the following:

    if(err) {
            if(err.type === 'notLoggedinError' || err.type === 'loginError') {
                sasAdapter.url='/SASStoredProcess/guest';
                sasAdapter._disableCalls=false;
            }
        }
        else if(res && res.requestingPerson === 'webanon') {
            sasAdapter.url='/SASStoredProcess/guest';
            sasAdapter._disableCalls=false;
        }

from h54s.

boomskats avatar boomskats commented on August 30, 2024

You should be able to tell whether the user is logged in by looking at the requestingUser variable that's returned as part of every call, and use that to retrieve basic data (from STPs that guest users have access to in Metadata). Every call returns the ID of the user (see here). You can use this to decide how much you render at the front-end, or decide to show a modal that will allow for optional full authentication that submits credentials to adapter.login().

The library autodetects redirects to SASLogon and caters for the timeouts. Have a look at the example implementation in AngularJS here (yes it's old but it's clean :)

from h54s.

Ices-Eyes avatar Ices-Eyes commented on August 30, 2024

Yes, that is the right process I used in another app. But in this case, if I first call a stp with the /guest page, SAS automatically disconnect any active user and create a new session with the webanon user. So I have to see if I can use the /do url giving webanon the read access to a stp that just check the user, switching after that to the /guest url in case of webanon user... But this check would be better if I can do a sync call instead of an async one. That's why the second question in the first post :)

from h54s.

boomskats avatar boomskats commented on August 30, 2024

Ah ok @Ices-Eyes , I understand this now I think. You can configure a main adapter instance and use it to try to access any program that requires a login with the default /do configuration. If your user is not logged in the call request will return a notloggedin error. When you handle that error in your code, you can create a second instance of the adapter (something like var anonAdapter = new h54s({"url":"/SASStoredProcess/anon"}) and proceed to use that for your subsequent requests.

Does that make sense?

from h54s.

boomskats avatar boomskats commented on August 30, 2024

Great! Closing this

from h54s.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.