Comments (5)
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.
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.
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.
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.
Great! Closing this
from h54s.
Related Issues (20)
- getFileDetails method should return parentFolderUri param in response
- Managed request needs patch method
- Fix getObjectOfTable HOT 1
- Info for h54s request and file download
- Possible to specify encoding when serializing json HOT 2
- Optimize the code for converting json to dataset HOT 7
- Update documentation to include example of h54sConfig.json format HOT 3
- Support for newline character HOT 1
- h54s Decoding Issue for French Characters HOT 4
- support for SAS side error handling HOT 3
- maxXhrRetries should be lowered HOT 1
- adapter changing two double quotes to one in response HOT 1
- Just a little improvement to suggest HOT 1
- Broken link to docs :( HOT 2
- Resolve items found in yarn audit HOT 1
- Handle 404 errors on viya HOT 1
- getFolderContents() doesn't handle error if first api call fails HOT 1
- Update our outdated licence HOT 3
- Problems with internet explorer HOT 7
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from h54s.